azils3 commited on
Commit
b86959c
·
verified ·
1 Parent(s): e40d438

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -9
Dockerfile CHANGED
@@ -1,5 +1,6 @@
1
  FROM nvidia/cuda:12.2.0-devel-ubuntu22.04
2
 
 
3
  RUN apt update && \
4
  apt install -y --no-install-recommends \
5
  curl \
@@ -25,11 +26,14 @@ RUN apt update && \
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 \
@@ -41,10 +45,10 @@ ENV USERNAME=user \
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 \
@@ -60,8 +64,6 @@ RUN RELEASE_TAG=$(curl -sX GET "https://api.github.com/repos/gitpod-io/openvscod
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
 
63
-
64
-
65
  # Install Firefox within VS-code
66
  RUN install -d -m 0755 /etc/apt/keyrings && \
67
  wget -q https://packages.mozilla.org/apt/repo-signing-key.gpg -O- | tee /etc/apt/keyrings/packages.mozilla.org.asc > /dev/null && \
@@ -70,7 +72,7 @@ RUN install -d -m 0755 /etc/apt/keyrings && \
70
  echo 'Package: *\nPin: origin packages.mozilla.org\nPin-Priority: 1000\n' | tee /etc/apt/preferences.d/mozilla && \
71
  apt-get update && \
72
  apt-get install -y firefox
73
-
74
  # Download and install GeckoDriver for x86_64 architecture
75
  RUN wget https://github.com/mozilla/geckodriver/releases/download/v0.34.0/geckodriver-v0.34.0-linux64.tar.gz && \
76
  tar -xvzf geckodriver-v0.34.0-linux64.tar.gz && \
@@ -78,20 +80,24 @@ RUN wget https://github.com/mozilla/geckodriver/releases/download/v0.34.0/geckod
78
  sudo chmod +x /usr/local/bin/geckodriver && \
79
  geckodriver --version
80
 
81
- RUN RUN curl -sSL https://pdm-project.org/install-pdm.py | python3 -
 
82
 
 
83
  WORKDIR /home/user/
84
 
85
- # Creating the user and usergroup
86
  RUN groupadd --gid ${USER_GID} ${USERNAME} \
87
  && useradd --uid ${USER_UID} --gid ${USERNAME} -m -s /bin/bash ${USERNAME} \
88
  && echo ${USERNAME} ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/${USERNAME} \
89
  && chmod 0440 /etc/sudoers.d/${USERNAME}
90
 
 
91
  RUN chmod g+rw /home && \
92
  chown -R ${USERNAME}:${USERNAME} ${OPENVSCODE_SERVER_ROOT} && \
93
  chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}
94
 
 
95
  USER $USERNAME
96
 
97
  # Install oh-my-zsh & Init
@@ -106,4 +112,5 @@ COPY requirements.txt .
106
  RUN pip install --no-cache-dir -r requirements.txt && \
107
  rm -rf requirements.txt
108
 
 
109
  ENTRYPOINT ["/bin/sh", "-c", "exec $OPENVSCODE --host 0.0.0.0 --port 7860 --without-connection-token"]
 
1
  FROM nvidia/cuda:12.2.0-devel-ubuntu22.04
2
 
3
+ # Install necessary packages
4
  RUN apt update && \
5
  apt install -y --no-install-recommends \
6
  curl \
 
26
  imagemagick \
27
  && git lfs install \
28
  && rm -rf /var/lib/apt/lists/*
29
+
30
+ # Fix ImageMagick policy
31
  RUN sed -i '/<policy domain="path" rights="none" pattern="@\*"/d' /etc/ImageMagick-6/policy.xml
32
 
33
+ # Set working directory
34
  WORKDIR /home/
35
 
36
+ # Environment variables
37
  ENV USERNAME=user \
38
  USER_UID=1000 \
39
  USER_GID=1000 \
 
45
  VISUAL=code \
46
  GIT_EDITOR="code --wait" \
47
  OPENVSCODE_SERVER_ROOT=/home/.vscode \
48
+ OPENVSCODE=/home/.vscode/bin/openvscode-server \
49
+ PATH="/home/user/.local/bin:$PATH"
50
 
51
+ # Download and install OpenVSCode Server
 
52
  RUN RELEASE_TAG=$(curl -sX GET "https://api.github.com/repos/gitpod-io/openvscode-server/releases/latest" | awk '/tag_name/{print $4;exit}' FS='[""]') && \
53
  arch=$(uname -m) && \
54
  if [ "${arch}" = "x86_64" ]; then \
 
64
  cp ${OPENVSCODE_SERVER_ROOT}/bin/remote-cli/openvscode-server ${OPENVSCODE_SERVER_ROOT}/bin/remote-cli/code && \
65
  rm -f ${RELEASE_TAG}-linux-${arch}.tar.gz
66
 
 
 
67
  # Install Firefox within VS-code
68
  RUN install -d -m 0755 /etc/apt/keyrings && \
69
  wget -q https://packages.mozilla.org/apt/repo-signing-key.gpg -O- | tee /etc/apt/keyrings/packages.mozilla.org.asc > /dev/null && \
 
72
  echo 'Package: *\nPin: origin packages.mozilla.org\nPin-Priority: 1000\n' | tee /etc/apt/preferences.d/mozilla && \
73
  apt-get update && \
74
  apt-get install -y firefox
75
+
76
  # Download and install GeckoDriver for x86_64 architecture
77
  RUN wget https://github.com/mozilla/geckodriver/releases/download/v0.34.0/geckodriver-v0.34.0-linux64.tar.gz && \
78
  tar -xvzf geckodriver-v0.34.0-linux64.tar.gz && \
 
80
  sudo chmod +x /usr/local/bin/geckodriver && \
81
  geckodriver --version
82
 
83
+ # Install PDM
84
+ RUN curl -sSL https://pdm-project.org/install-pdm.py | python3 -
85
 
86
+ # Set working directory for user
87
  WORKDIR /home/user/
88
 
89
+ # Create user and usergroup
90
  RUN groupadd --gid ${USER_GID} ${USERNAME} \
91
  && useradd --uid ${USER_UID} --gid ${USERNAME} -m -s /bin/bash ${USERNAME} \
92
  && echo ${USERNAME} ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/${USERNAME} \
93
  && chmod 0440 /etc/sudoers.d/${USERNAME}
94
 
95
+ # Set permissions
96
  RUN chmod g+rw /home && \
97
  chown -R ${USERNAME}:${USERNAME} ${OPENVSCODE_SERVER_ROOT} && \
98
  chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}
99
 
100
+ # Switch to user
101
  USER $USERNAME
102
 
103
  # Install oh-my-zsh & Init
 
112
  RUN pip install --no-cache-dir -r requirements.txt && \
113
  rm -rf requirements.txt
114
 
115
+ # Entry point
116
  ENTRYPOINT ["/bin/sh", "-c", "exec $OPENVSCODE --host 0.0.0.0 --port 7860 --without-connection-token"]