azils3 commited on
Commit
3d5918e
·
verified ·
1 Parent(s): 4d6ef98

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +126 -0
Dockerfile ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use an official CUDA runtime as a parent image
2
+ FROM nvidia/cuda:12.2.0-devel-ubuntu22.04
3
+
4
+ ENV DEBIAN_FRONTEND=noninteractive
5
+
6
+ # Update and install necessary packages
7
+ RUN apt update && \
8
+ apt install -y --no-install-recommends \
9
+ curl \
10
+ git \
11
+ git-lfs \
12
+ libatomic1 \
13
+ locales \
14
+ gettext \
15
+ man \
16
+ nano \
17
+ net-tools \
18
+ netcat \
19
+ openssh-client \
20
+ python3 \
21
+ python3-pip \
22
+ python3-venv \
23
+ sudo \
24
+ vim \
25
+ wget \
26
+ zsh \
27
+ zip \
28
+ unzip \
29
+ ffmpeg \
30
+ gettext \
31
+ imagemagick \
32
+ build-essential \
33
+ libssl-dev \
34
+ libffi-dev \
35
+ python3-dev \
36
+ libblas-dev \
37
+ liblapack-dev \
38
+ gfortran \
39
+ libsndfile1 \
40
+ libespeak-ng1 \
41
+ libportaudio2 \
42
+ libportaudiocpp0 \
43
+ portaudio19-dev \
44
+ libsndfile1-dev \
45
+ jq && \
46
+ git lfs install && \
47
+ rm -rf /var/lib/apt/lists/*
48
+
49
+ # Fix ImageMagick policy
50
+ RUN sed -i '/<policy domain="path" rights="none" pattern="@\*"/d' /etc/ImageMagick-6/policy.xml
51
+
52
+ WORKDIR /home/
53
+
54
+ ENV USERNAME=user \
55
+ USER_UID=1000 \
56
+ USER_GID=1000 \
57
+ LANG=C.UTF-8 \
58
+ LC_ALL=C.UTF-8 \
59
+ NVIDIA_VISIBLE_DEVICES=all \
60
+ NVIDIA_DRIVER_CAPABILITIES=all \
61
+ EDITOR=code \
62
+ VISUAL=code \
63
+ GIT_EDITOR="code --wait" \
64
+ OPENVSCODE_SERVER_ROOT=/home/.vscode \
65
+ OPENVSCODE=/home/.vscode/bin/openvscode-server \
66
+ PATH=/home/user/.local/bin:/home/user/.poetry/bin:$PATH
67
+
68
+ # Downloading the latest VSC Server release and extracting the release archive
69
+ # Rename `openvscode-server` cli tool to `code` for convenience
70
+ RUN RELEASE_TAG=$(curl -sX GET "https://api.github.com/repos/gitpod-io/openvscode-server/releases/latest" | awk '/tag_name/{print $4;exit}' FS='[""]') && \
71
+ arch=$(uname -m) && \
72
+ if [ "${arch}" = "x86_64" ]; then \
73
+ arch="x64"; \
74
+ elif [ "${arch}" = "aarch64" ]; then \
75
+ arch="arm64"; \
76
+ elif [ "${arch}" = "armv7l" ]; then \
77
+ arch="armhf"; \
78
+ fi && \
79
+ wget https://github.com/gitpod-io/openvscode-server/releases/download/${RELEASE_TAG}/${RELEASE_TAG}-linux-${arch}.tar.gz && \
80
+ tar -xzf ${RELEASE_TAG}-linux-${arch}.tar.gz && \
81
+ mv ${RELEASE_TAG}-linux-${arch} ${OPENVSCODE_SERVER_ROOT} && \
82
+ cp ${OPENVSCODE_SERVER_ROOT}/bin/remote-cli/openvscode-server ${OPENVSCODE_SERVER_ROOT}/bin/remote-cli/code && \
83
+ rm -f ${RELEASE_TAG}-linux-${arch}.tar.gz
84
+
85
+ # Install latest Firefox
86
+ RUN sudo install -d -m 0755 /etc/apt/keyrings && \
87
+ wget -q https://packages.mozilla.org/apt/repo-signing-key.gpg -O- | sudo tee /etc/apt/keyrings/packages.mozilla.org.asc > /dev/null && \
88
+ echo "deb [signed-by=/etc/apt/keyrings/packages.mozilla.org.asc] https://packages.mozilla.org/apt mozilla main" | sudo tee -a /etc/apt/sources.list.d/mozilla.list > /dev/null && \
89
+ echo 'Package: *\nPin: origin packages.mozilla.org\nPin-Priority: 1000' | sudo tee /etc/apt/preferences.d/mozilla && \
90
+ sudo apt-get update && sudo apt-get install -y firefox
91
+
92
+ # Download and install latest GeckoDriver
93
+ RUN GECKO_LATEST=$(curl -sL https://api.github.com/repos/mozilla/geckodriver/releases/latest | jq -r '.tag_name') && \
94
+ wget https://github.com/mozilla/geckodriver/releases/download/${GECKO_LATEST}/geckodriver-${GECKO_LATEST}-linux64.tar.gz && \
95
+ tar -xvzf geckodriver-${GECKO_LATEST}-linux64.tar.gz && \
96
+ sudo mv geckodriver /usr/local/bin/ && \
97
+ sudo chmod +x /usr/local/bin/geckodriver && \
98
+ rm geckodriver-${GECKO_LATEST}-linux64.tar.gz && \
99
+ geckodriver --version
100
+
101
+ WORKDIR /home/user/
102
+
103
+ # Creating the user and usergroup
104
+ RUN groupadd --gid ${USER_GID} ${USERNAME} && \
105
+ useradd --uid ${USER_UID} --gid ${USERNAME} -m -s /bin/bash ${USERNAME} && \
106
+ echo ${USERNAME} ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/${USERNAME} && \
107
+ chmod 0440 /etc/sudoers.d/${USERNAME}
108
+
109
+ RUN chmod g+rw /home && \
110
+ chown -R ${USERNAME}:${USERNAME} ${OPENVSCODE_SERVER_ROOT} && \
111
+ chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}
112
+
113
+ USER $USERNAME
114
+
115
+ # Install oh-my-zsh & Init
116
+ RUN yes | sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
117
+
118
+ # Install VSCode Extensions
119
+ RUN ${OPENVSCODE} --install-extension ms-python.python && \
120
+ ${OPENVSCODE} --install-extension monokai.theme-monokai-pro-vscode
121
+
122
+ # Install Poetry
123
+ RUN curl -sSL https://install.python-poetry.org | python3 -
124
+
125
+ # Set the entrypoint for the application
126
+ ENTRYPOINT ["/bin/sh", "-c", "exec $OPENVSCODE --host 0.0.0.0 --port 7860 --without-connection-token"]