Create Dockerfile
Browse files- Dockerfile +108 -0
Dockerfile
ADDED
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM nvidia/cuda:12.2.0-devel-ubuntu22.04
|
2 |
+
|
3 |
+
RUN apt update && \
|
4 |
+
apt install -y --no-install-recommends \
|
5 |
+
curl \
|
6 |
+
git \
|
7 |
+
git-lfs \
|
8 |
+
libatomic1 \
|
9 |
+
locales \
|
10 |
+
man \
|
11 |
+
nano \
|
12 |
+
net-tools \
|
13 |
+
netcat \
|
14 |
+
openssh-client \
|
15 |
+
python3 \
|
16 |
+
python3-pip \
|
17 |
+
python3-venv \
|
18 |
+
sudo \
|
19 |
+
vim \
|
20 |
+
wget \
|
21 |
+
zsh \
|
22 |
+
zip \
|
23 |
+
unzip \
|
24 |
+
ffmpeg \
|
25 |
+
imagemagick \
|
26 |
+
&& git lfs install \
|
27 |
+
&& rm -rf /var/lib/apt/lists/*
|
28 |
+
|
29 |
+
# Fix ImageMagick policy
|
30 |
+
RUN sed -i '/<policy domain="path" rights="none" pattern="@\*"/d' /etc/ImageMagick-6/policy.xml
|
31 |
+
|
32 |
+
WORKDIR /home/
|
33 |
+
|
34 |
+
ENV USERNAME=user \
|
35 |
+
USER_UID=1000 \
|
36 |
+
USER_GID=1000 \
|
37 |
+
LANG=C.UTF-8 \
|
38 |
+
LC_ALL=C.UTF-8 \
|
39 |
+
NVIDIA_VISIBLE_DEVICES=all \
|
40 |
+
NVIDIA_DRIVER_CAPABILITIES=all \
|
41 |
+
EDITOR=code \
|
42 |
+
VISUAL=code \
|
43 |
+
GIT_EDITOR="code --wait" \
|
44 |
+
OPENVSCODE_SERVER_ROOT=/home/.vscode \
|
45 |
+
OPENVSCODE=/home/.vscode/bin/openvscode-server \
|
46 |
+
PATH=/home/user/.local/bin:$PATH
|
47 |
+
|
48 |
+
# Downloading the latest VSC Server release and extracting the release archive
|
49 |
+
# Rename `openvscode-server` cli tool to `code` for convenience
|
50 |
+
RUN RELEASE_TAG=$(curl -sX GET "https://api.github.com/repos/gitpod-io/openvscode-server/releases/latest" | awk '/tag_name/{print $4;exit}' FS='[""]') && \
|
51 |
+
arch=$(uname -m) && \
|
52 |
+
if [ "${arch}" = "x86_64" ]; then \
|
53 |
+
arch="x64"; \
|
54 |
+
elif [ "${arch}" = "aarch64" ]; then \
|
55 |
+
arch="arm64"; \
|
56 |
+
elif [ "${arch}" = "armv7l" ]; then \
|
57 |
+
arch="armhf"; \
|
58 |
+
fi && \
|
59 |
+
wget https://github.com/gitpod-io/openvscode-server/releases/download/${RELEASE_TAG}/${RELEASE_TAG}-linux-${arch}.tar.gz && \
|
60 |
+
tar -xzf ${RELEASE_TAG}-linux-${arch}.tar.gz && \
|
61 |
+
mv ${RELEASE_TAG}-linux-${arch} ${OPENVSCODE_SERVER_ROOT} && \
|
62 |
+
cp ${OPENVSCODE_SERVER_ROOT}/bin/remote-cli/openvscode-server ${OPENVSCODE_SERVER_ROOT}/bin/remote-cli/code && \
|
63 |
+
rm -f ${RELEASE_TAG}-linux-${arch}.tar.gz
|
64 |
+
|
65 |
+
|
66 |
+
# Download and install GeckoDriver for x86_64 architecture
|
67 |
+
RUN wget https://github.com/mozilla/geckodriver/releases/download/v0.34.0/geckodriver-v0.34.0-linux64.tar.gz && \
|
68 |
+
tar -xvzf geckodriver-v0.34.0-linux64.tar.gz && \
|
69 |
+
sudo mv geckodriver /usr/local/bin/ && \
|
70 |
+
sudo chmod +x /usr/local/bin/geckodriver && \
|
71 |
+
geckodriver --version
|
72 |
+
|
73 |
+
RUN apt-get install -y lsb-release curl gnupg && \
|
74 |
+
curl -fsSL https://packages.redis.io/gpg | gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg && \
|
75 |
+
chmod 644 /usr/share/keyrings/redis-archive-keyring.gpg && \
|
76 |
+
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/redis.list && \
|
77 |
+
apt-get update && \
|
78 |
+
apt-get install -y redis && \
|
79 |
+
redis-server --daemonize yes
|
80 |
+
|
81 |
+
WORKDIR /home/user/
|
82 |
+
|
83 |
+
# Creating the user and usergroup
|
84 |
+
RUN groupadd --gid ${USER_GID} ${USERNAME} \
|
85 |
+
&& useradd --uid ${USER_UID} --gid ${USERNAME} -m -s /bin/bash ${USERNAME} \
|
86 |
+
&& echo ${USERNAME} ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/${USERNAME} \
|
87 |
+
&& chmod 0440 /etc/sudoers.d/${USERNAME}
|
88 |
+
|
89 |
+
RUN chmod g+rw /home && \
|
90 |
+
chown -R ${USERNAME}:${USERNAME} ${OPENVSCODE_SERVER_ROOT} && \
|
91 |
+
chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}
|
92 |
+
|
93 |
+
USER $USERNAME
|
94 |
+
|
95 |
+
# Install oh-my-zsh & Init
|
96 |
+
RUN yes | sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
|
97 |
+
|
98 |
+
# Install VSCode Extensions
|
99 |
+
RUN ${OPENVSCODE} --install-extension ms-python.python && \
|
100 |
+
${OPENVSCODE} --install-extension monokai.theme-monokai-pro-vscode
|
101 |
+
|
102 |
+
# Install python packages
|
103 |
+
COPY requirements.txt .
|
104 |
+
RUN pip install --upgrade pip && \
|
105 |
+
pip install --no-cache-dir -r requirements.txt && \
|
106 |
+
rm -rf requirements.txt
|
107 |
+
|
108 |
+
ENTRYPOINT ["/bin/sh", "-c", "exec $OPENVSCODE --host 0.0.0.0 --port 7860 --without-connection-token"]
|