ar08 commited on
Commit
70cf9fa
·
verified ·
1 Parent(s): a112181

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +56 -53
Dockerfile CHANGED
@@ -1,58 +1,61 @@
1
- # syntax=docker/dockerfile:experimental
 
2
 
3
- ARG BASE=debian:12
4
- FROM scratch AS packages
5
- COPY release-packages/code-server*.deb /tmp/
6
 
7
- FROM $BASE
8
-
9
- RUN apt-get update \
10
- && apt-get install -y \
11
  curl \
12
- dumb-init \
13
- git \
14
- git-lfs \
15
- htop \
16
- locales \
17
- lsb-release \
18
- man-db \
19
- nano \
20
- openssh-client \
21
- procps \
22
  sudo \
23
- vim-tiny \
24
- wget \
25
- zsh \
26
- && git lfs install \
27
- && rm -rf /var/lib/apt/lists/*
28
-
29
- # https://wiki.debian.org/Locale#Manually
30
- RUN sed -i "s/# en_US.UTF-8/en_US.UTF-8/" /etc/locale.gen \
31
- && locale-gen
32
- ENV LANG=en_US.UTF-8
33
-
34
- RUN adduser --gecos '' --disabled-password coder \
35
- && echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd
36
-
37
- RUN ARCH="$(dpkg --print-architecture)" \
38
- && curl -fsSL "https://github.com/boxboat/fixuid/releases/download/v0.6.0/fixuid-0.6.0-linux-$ARCH.tar.gz" | tar -C /usr/local/bin -xzf - \
39
- && chown root:root /usr/local/bin/fixuid \
40
- && chmod 4755 /usr/local/bin/fixuid \
41
- && mkdir -p /etc/fixuid \
42
- && printf "user: coder\ngroup: coder\n" > /etc/fixuid/config.yml
43
-
44
- COPY ci/release-image/entrypoint.sh /usr/bin/entrypoint.sh
45
- RUN --mount=from=packages,src=/tmp,dst=/tmp/packages dpkg -i /tmp/packages/code-server*$(dpkg --print-architecture).deb
46
-
47
- # Allow users to have scripts run on container startup to prepare workspace.
48
- # https://github.com/coder/code-server/issues/5177
49
- ENV ENTRYPOINTD=${HOME}/entrypoint.d
50
-
 
 
 
 
 
 
 
 
 
 
 
 
51
  EXPOSE 8080
52
- # This way, if someone sets $DOCKER_USER, docker-exec will still work as
53
- # the uid will remain the same. note: only relevant if -u isn't passed to
54
- # docker-run.
55
- USER 1000
56
- ENV USER=coder
57
- WORKDIR /home/coder
58
- ENTRYPOINT ["/usr/bin/entrypoint.sh", "--bind-addr", "0.0.0.0:8080", "."]
 
 
 
1
+ # Use Python 3.9 as the base image
2
+ FROM python:3.9
3
 
4
+ # Set environment variables
5
+ ENV DEBIAN_FRONTEND=noninteractive
 
6
 
7
+ # Install necessary packages
8
+ RUN apt-get update && \
9
+ apt-get install -y \
 
10
  curl \
 
 
 
 
 
 
 
 
 
 
11
  sudo \
12
+ build-essential \
13
+ default-jdk \
14
+ default-jre \
15
+ g++ \
16
+ gcc
17
+
18
+ # Install code-server
19
+ RUN curl -fsSL https://code-server.dev/install.sh | sh
20
+
21
+ # Create a user to run code-server
22
+ RUN useradd -m -s /bin/bash coder && \
23
+ echo 'coder ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
24
+
25
+ # Create and set the working directory
26
+ RUN mkdir -p /home/coder/genz
27
+ WORKDIR /home/coder/genz
28
+
29
+ # Change ownership of the working directory
30
+ RUN chown -R coder:coder /home/coder/genz
31
+
32
+ # Create code-server configuration directory
33
+ RUN mkdir -p /home/coder/.config/code-server
34
+
35
+ # Add settings.json to enable dark mode and disable telemetry
36
+ RUN echo '{ \
37
+ "workbench.colorTheme": "Default Dark+", \
38
+ "telemetry.enableTelemetry": false, \
39
+ "telemetry.enableCrashReporter": false \
40
+ }' > /home/coder/.config/code-server/settings.json
41
+
42
+ # Install Python extension for code-server
43
+ RUN mkdir -p /home/coder/.local/share/code-server/extensions && \
44
+ curl -L -o /home/coder/.local/share/code-server/extensions/ms-python.python-2022.2.1924087327.vsix https://marketplace.visualstudio.com/_apis/public/gallery/publishers/ms-python/vsextensions/python/2022.2.1924087327/vspackage && \
45
+ code-server --install-extension /home/coder/.local/share/code-server/extensions/ms-python.python-2022.2.1924087327.vsix
46
+
47
+ # Change ownership of the configuration and extension directories
48
+ RUN chown -R coder:coder /home/coder/.config && \
49
+ chown -R coder:coder /home/coder/.local
50
+
51
+ # Expose the default code-server port
52
  EXPOSE 8080
53
+
54
+ # Define a volume for the genz folder
55
+ VOLUME /home/coder/genz
56
+
57
+ # Switch to the coder user for running code-server
58
+ USER coder
59
+ WORKDIR genz
60
+ # Start code-server
61
+ CMD ["code-server", "--bind-addr", "0.0.0.0:8080", "--auth", "none"]