| 1 |
# syntax = docker/dockerfile:1.2.1 |
| 2 |
FROM ubuntu:20.04 |
| 3 |
RUN --mount=type=cache,target=/var/cache/apt \ |
| 4 |
rm -f /etc/apt/apt.conf.d/docker-clean \ |
| 5 |
&& apt-get update \ |
| 6 |
&& apt-get -y install \ |
| 7 |
iputils-ping \ |
| 8 |
bind9-utils \ |
| 9 |
wget \ |
| 10 |
openssh-server |
| 11 |
|
| 12 |
ENV MAMBA_ROOT_PREFIX=/opt/conda |
| 13 |
ENV PATH=$MAMBA_ROOT_PREFIX/bin:$PATH |
| 14 |
ENV IPP_DISABLE_JS=1 |
| 15 |
# x86_64 -> 64, aarch64 unmodified |
| 16 |
RUN ARCH=$(uname -m | sed s@x86_@@) \ |
| 17 |
&& wget -qO- https://github.com/mamba-org/micromamba-releases/releases/latest/download/micromamba-linux-${ARCH} > /usr/local/bin/micromamba \ |
| 18 |
&& chmod +x /usr/local/bin/micromamba |
| 19 |
|
| 20 |
RUN --mount=type=cache,target=${MAMBA_ROOT_PREFIX}/pkgs \ |
| 21 |
micromamba install -y -p $MAMBA_ROOT_PREFIX -c conda-forge \ |
| 22 |
python=3.8 \ |
| 23 |
pip \ |
| 24 |
ipyparallel |
| 25 |
|
| 26 |
# generate a user with home directory and trusted ssh keypair |
| 27 |
RUN useradd -m -s /bin/bash -N ciuser |
| 28 |
USER ciuser |
| 29 |
RUN mkdir ~/.ssh \ |
| 30 |
&& chmod 0700 ~/.ssh \ |
| 31 |
&& ssh-keygen -q -t rsa -N '' -f /home/ciuser/.ssh/id_rsa \ |
| 32 |
&& cat ~/.ssh/id_rsa.pub > ~/.ssh/authorized_keys \ |
| 33 |
&& chmod 0600 ~/.ssh/* |
| 34 |
USER root |
| 35 |
|
| 36 |
|
| 37 |
ENV PIP_CACHE_DIR=/tmp/pip-cache |
| 38 |
COPY . /src/ipyparallel |
| 39 |
RUN --mount=type=cache,target=${PIP_CACHE_DIR} python3 -m pip install -e 'file:///src/ipyparallel#egg=ipyparallel[test]' |
| 40 |
|
| 41 |
# needed for sshd to start |
| 42 |
RUN mkdir /run/sshd |
| 43 |
# run sshd in the foreground |
| 44 |
CMD /usr/sbin/sshd -D -e |