-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathDockerfile
70 lines (53 loc) · 2.84 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
ARG DOCKER_REGISTRY=docker.io
ARG TORCH_VERS=2.4.1
ARG CUDA_VERS=12.1
ARG INJECT_MF_CERT
#####################################################
### Default base image if no crt file is provided ###
#####################################################
FROM ${DOCKER_REGISTRY}/pytorch/pytorch:${TORCH_VERS}-cuda${CUDA_VERS}-cudnn9-devel as base_crt_injected_0
###################################################
### Custom base image if a crt file is provided ###
###################################################
FROM base_crt_injected_0 as base_crt_injected_1
ARG INJECT_MF_CERT
# The following two lines are necessary to deal with the MITM sniffing proxy we have internally.
COPY mf.crt /usr/local/share/ca-certificates/mf.crt
RUN ( test $INJECT_MF_CERT -eq 1 && update-ca-certificates ) || echo "MF certificate not injected"
ENV REQUESTS_CA_BUNDLE="/usr/local/share/ca-certificates/mf.crt"
ENV CURL_CA_BUNDLE="/usr/local/share/ca-certificates/mf.crt"
#################################################
### Final image inherited from the base image ###
#################################################
FROM base_crt_injected_${INJECT_MF_CERT}
ARG HTTP_PROXY
ARG HTTPS_PROXY
# set apt to non interactive
ENV DEBIAN_FRONTEND=noninteractive
ENV MY_APT='apt -o "Acquire::https::Verify-Peer=false" -o "Acquire::AllowInsecureRepositories=true" -o "Acquire::AllowDowngradeToInsecureRepositories=true" -o "Acquire::https::Verify-Host=false"'
RUN $MY_APT update && $MY_APT install -y software-properties-common && add-apt-repository ppa:ubuntugis/ppa
RUN $MY_APT update && $MY_APT install -y curl gdal-bin libgdal-dev libgeos-dev git vim nano sudo libx11-dev tk python3-tk tk-dev libpng-dev libffi-dev dvipng texlive-latex-base texlive-latex-extra texlive-fonts-recommended cm-super openssh-server netcat libeccodes-dev libeccodes-tools openssh-server
ENV CPLUS_INCLUDE_PATH=/usr/include/gdal
ENV C_INCLUDE_PATH=/usr/include/gdal
RUN pip install --upgrade pip
COPY requirements.txt /app/requirements.txt
RUN set -eux \
&& pip install --default-timeout=100 -r /app/requirements.txt
COPY requirements_lint.txt /app/requirements_lint.txt
RUN pip install --default-timeout=100 -r /app/requirements_lint.txt
ARG USERNAME
ARG GROUPNAME
ARG USER_UID
ARG USER_GUID
ARG HOME_DIR
ARG NODE_EXTRA_CA_CERTS
RUN set -eux && groupadd --gid $USER_GUID $GROUPNAME \
# https://stackoverflow.com/questions/73208471/docker-build-issue-stuck-at-exporting-layers
&& mkdir -p $HOME_DIR && useradd -l --uid $USER_UID --gid $USER_GUID -s /bin/bash --home-dir $HOME_DIR --create-home $USERNAME \
&& chown $USERNAME:$GROUPNAME $HOME_DIR \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME \
&& echo "$USERNAME:$USERNAME" | chpasswd \
&& mkdir /run/sshd
WORKDIR $HOME_DIR
RUN curl -fsSL https://code-server.dev/install.sh | sh