-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathbase.Dockerfile
More file actions
114 lines (95 loc) · 4.17 KB
/
base.Dockerfile
File metadata and controls
114 lines (95 loc) · 4.17 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
ARG AMD64_BASE
ARG ARM64_BASE
ARG DEVEL_IMAGE
FROM ${DEVEL_IMAGE} as devel
FROM ${AMD64_BASE} as base-amd64
FROM ${ARM64_BASE} as base-arm64
ONBUILD RUN cd /usr/local/cuda/lib64 \
&& ln -s \
libcudart.so.$(nvcc --version | head -n4 | tail -n1 | cut -d' ' -f5 | cut -d',' -f1) \
libcudart.so.$(nvcc --version | head -n4 | tail -n1 | cut -d' ' -f5 | cut -d',' -f1 | cut -d'.' -f1) \
&& ln -s \
libcudart.so.$(nvcc --version | head -n4 | tail -n1 | cut -d' ' -f5 | cut -d',' -f1 | cut -d'.' -f1) \
libcudart.so \
&& rm /etc/ld.so.cache && ldconfig
ONBUILD ARG ADDITIONAL_GROUPS="--groups video"
FROM base-${TARGETARCH}
SHELL ["/bin/bash", "-c"]
ENV NVIDIA_DRIVER_CAPABILITIES all
ENV CUDA_HOME="/usr/local/cuda"
ENV LD_LIBRARY_PATH="\
/usr/lib/aarch64-linux-gnu:\
/usr/lib/x86_64-linux-gnu:\
/usr/lib/i386-linux-gnu:\
${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}\
${CUDA_HOME}/lib64:\
${CUDA_HOME}/nvvm/lib64:\
${CUDA_HOME}/lib64/stubs"
ADD --chown=root:root https://gitlab.com/nvidia/container-images/opengl/-/raw/5191cf205d3e4bb1150091f9464499b076104354/glvnd/runtime/10_nvidia.json /usr/share/glvnd/egl_vendor.d/10_nvidia.json
# Install gcc-9 toolchain
RUN export DEBIAN_FRONTEND=noninteractive \
# Workaround for https://forums.developer.nvidia.com/t/notice-cuda-linux-repository-key-rotation/212772
&& apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/$( \
. /etc/os-release; echo $NAME$VERSION_ID | tr -d '.' | tr '[:upper:]' '[:lower:]' \
)/$(uname -p)/3bf863cc.pub \
\
&& apt update \
&& apt install --no-install-recommends -y \
software-properties-common \
&& add-apt-repository --no-update -y ppa:ubuntu-toolchain-r/test \
&& apt update \
&& apt install --no-install-recommends -y \
libstdc++6 \
# From opengl/glvnd:runtime
libxau6 libxdmcp6 libxcb1 libxext6 libx11-6 \
libglvnd0 libopengl0 libgl1 libglx0 libegl1 libgles2 \
\
&& chmod 0644 /usr/share/glvnd/egl_vendor.d/10_nvidia.json \
&& echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf \
&& echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf \
# Clean up
&& add-apt-repository --remove -y ppa:ubuntu-toolchain-r/test \
&& apt remove -y software-properties-common \
&& apt autoremove -y && apt clean \
&& rm -rf \
/tmp/* \
/var/tmp/* \
/var/lib/apt/lists/* \
/var/cache/apt/archives/*
# Install node
COPY --from=devel /usr/local/bin/node /usr/local/bin/node
COPY --from=devel /usr/local/include/node /usr/local/include/node
COPY --from=devel /usr/local/lib/node_modules /usr/local/lib/node_modules
# Install yarn
COPY --from=devel /usr/local/bin/yarn /usr/local/bin/yarn
COPY --from=devel /usr/local/bin/yarn.js /usr/local/bin/yarn.js
COPY --from=devel /usr/local/bin/yarn.cmd /usr/local/bin/yarn.cmd
COPY --from=devel /usr/local/bin/yarnpkg /usr/local/bin/yarnpkg
COPY --from=devel /usr/local/bin/yarnpkg.cmd /usr/local/bin/yarnpkg.cmd
COPY --from=devel /usr/local/lib/cli.js /usr/local/lib/cli.js
COPY --from=devel /usr/local/lib/v8-compile-cache.js /usr/local/lib/v8-compile-cache.js
# Copy entrypoint
COPY --from=devel /usr/local/bin/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
# Copy nvrtc libs
COPY --from=devel /usr/local/cuda/lib64/libnvrtc* /usr/local/cuda/lib64/
ARG UID=1000
ARG ADDITIONAL_GROUPS
RUN if getent passwd $UID >/dev/null 2>&1; then \
existing_user=$(getent passwd $UID | cut -d: -f1); \
usermod -l node -d /home/node -m $existing_user; \
groupmod -n node $existing_user; \
else \
useradd --uid $UID --user-group ${ADDITIONAL_GROUPS} --shell /bin/bash --create-home node; \
fi \
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs \
&& ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm \
&& ln -s /usr/local/lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx \
# smoke tests
&& node --version && npm --version && yarn --version
ENV npm_config_fund=false
ENV npm_config_update_notifier=false
ENV NODE_OPTIONS="--experimental-vm-modules --trace-uncaught"
WORKDIR /home/node
ENTRYPOINT ["docker-entrypoint.sh"]
SHELL ["/bin/bash", "-l"]
CMD ["node"]