azils3 commited on
Commit
2e246e5
·
verified ·
1 Parent(s): 6f65a3d

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +98 -0
Dockerfile ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ RUN sed -i '/<policy domain="path" rights="none" pattern="@\*"/d' /etc/ImageMagick-6/policy.xml
30
+
31
+ WORKDIR /home/
32
+
33
+ ENV USERNAME=user \
34
+ USER_UID=1000 \
35
+ USER_GID=1000 \
36
+ LANG=C.UTF-8 \
37
+ LC_ALL=C.UTF-8 \
38
+ NVIDIA_VISIBLE_DEVICES=all \
39
+ NVIDIA_DRIVER_CAPABILITIES=all \
40
+ EDITOR=code \
41
+ VISUAL=code \
42
+ GIT_EDITOR="code --wait" \
43
+ OPENVSCODE_SERVER_ROOT=/home/.vscode \
44
+ OPENVSCODE=/home/.vscode/bin/openvscode-server
45
+
46
+ # Downloading the latest VSC Server release and extracting the release archive
47
+ # Rename `openvscode-server` cli tool to `code` for convenience
48
+ RUN RELEASE_TAG=$(curl -sX GET "https://api.github.com/repos/gitpod-io/openvscode-server/releases/latest" | awk '/tag_name/{print $4;exit}' FS='[""]') && \
49
+ arch=$(uname -m) && \
50
+ if [ "${arch}" = "x86_64" ]; then \
51
+ arch="x64"; \
52
+ elif [ "${arch}" = "aarch64" ]; then \
53
+ arch="arm64"; \
54
+ elif [ "${arch}" = "armv7l" ]; then \
55
+ arch="armhf"; \
56
+ fi && \
57
+ wget https://github.com/gitpod-io/openvscode-server/releases/download/${RELEASE_TAG}/${RELEASE_TAG}-linux-${arch}.tar.gz && \
58
+ tar -xzf ${RELEASE_TAG}-linux-${arch}.tar.gz && \
59
+ mv ${RELEASE_TAG}-linux-${arch} ${OPENVSCODE_SERVER_ROOT} && \
60
+ cp ${OPENVSCODE_SERVER_ROOT}/bin/remote-cli/openvscode-server ${OPENVSCODE_SERVER_ROOT}/bin/remote-cli/code && \
61
+ rm -f ${RELEASE_TAG}-linux-${arch}.tar.gz
62
+ # Install Firefox within VS-code
63
+ RUN install -d -m 0755 /etc/apt/keyrings && \
64
+ wget -q https://packages.mozilla.org/apt/repo-signing-key.gpg -O- | tee /etc/apt/keyrings/packages.mozilla.org.asc > /dev/null && \
65
+ gpg -n -q --import --import-options import-show /etc/apt/keyrings/packages.mozilla.org.asc | awk '/pub/{getline; gsub(/^ +| +$/,""); if($0 == "35BAA0B33E9EB396F59CA838C0BA5CE6DC6315A3") print "\nThe key fingerprint matches ("$0").\n"; else print "\nVerification failed: the fingerprint ("$0") does not match the expected one.\n"}' && \
66
+ echo "deb [signed-by=/etc/apt/keyrings/packages.mozilla.org.asc] https://packages.mozilla.org/apt mozilla main" | tee -a /etc/apt/sources.list.d/mozilla.list > /dev/null && \
67
+ echo 'Package: *\nPin: origin packages.mozilla.org\nPin-Priority: 1000\n' | tee /etc/apt/preferences.d/mozilla && \
68
+ apt-get update && \
69
+ apt-get install -y firefox
70
+ RUN RUN curl -sSL https://pdm-project.org/install-pdm.py | python3 - \
71
+ export PATH=/home/user/.local/bin:$PATH
72
+ WORKDIR /home/user/
73
+
74
+ # Creating the user and usergroup
75
+ RUN groupadd --gid ${USER_GID} ${USERNAME} \
76
+ && useradd --uid ${USER_UID} --gid ${USERNAME} -m -s /bin/bash ${USERNAME} \
77
+ && echo ${USERNAME} ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/${USERNAME} \
78
+ && chmod 0440 /etc/sudoers.d/${USERNAME}
79
+
80
+ RUN chmod g+rw /home && \
81
+ chown -R ${USERNAME}:${USERNAME} ${OPENVSCODE_SERVER_ROOT} && \
82
+ chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}
83
+
84
+ USER $USERNAME
85
+
86
+ # Install oh-my-zsh & Init
87
+ RUN yes | sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
88
+
89
+ # Install VSCode Extensions
90
+ RUN ${OPENVSCODE} --install-extension ms-python.python && \
91
+ ${OPENVSCODE} --install-extension monokai.theme-monokai-pro-vscode
92
+
93
+ # Install python packages
94
+ COPY requirements.txt .
95
+ RUN pip3 install --no-cache-dir -r requirements.txt && \
96
+ rm -rf requirements.txt
97
+
98
+ ENTRYPOINT ["/bin/sh", "-c", "exec $OPENVSCODE --host 0.0.0.0 --port 7860 --without-connection-token"]