Manofem commited on
Commit
e01517f
·
verified ·
1 Parent(s): c7f8d8f

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +38 -15
Dockerfile CHANGED
@@ -1,7 +1,15 @@
1
- # Use Ubuntu as base image
2
- FROM ubuntu:latest
 
 
 
 
 
 
 
 
 
3
 
4
- # Install git and curl
5
  RUN apt-get update \
6
  && apt-get install -y \
7
  curl \
@@ -21,19 +29,34 @@ RUN apt-get update \
21
  zsh \
22
  && git lfs install \
23
  && rm -rf /var/lib/apt/lists/*
24
- # Clone the repository
25
- RUN git clone https://github.com/coder/code-server.git /code-server
26
 
27
- # Change directory to the cloned repository
28
- WORKDIR /code-server
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
- # Run CI script from the ci directory
31
- RUN cd ci
32
 
33
- # Copy entry point script
34
- COPY entrypoint.sh home/entrypoint.sh
 
35
 
36
- # Make entrypoint script executable
37
- RUN chmod +x *
38
- ENV ENTRYPOINTD=code-server/entrypoint.d
39
- ENTRYPOINT ["/code-server/ci/release-image/entrypoint.sh", "--bind-addr", "0.0.0.0:7860", "."]]
 
 
 
 
 
1
+ # syntax=docker/dockerfile:experimental
2
+ RUN git clone https://github.com/coder/code-server /tmp/code-server
3
+
4
+ # Change directory to code-server repository
5
+ WORKDIR /tmp/code-server/ci/release-image
6
+
7
+ ARG BASE=debian:12
8
+ FROM scratch AS packages
9
+ COPY release-packages/code-server*.deb /tmp/
10
+
11
+ FROM $BASE
12
 
 
13
  RUN apt-get update \
14
  && apt-get install -y \
15
  curl \
 
29
  zsh \
30
  && git lfs install \
31
  && rm -rf /var/lib/apt/lists/*
 
 
32
 
33
+ # https://wiki.debian.org/Locale#Manually
34
+ RUN sed -i "s/# en_US.UTF-8/en_US.UTF-8/" /etc/locale.gen \
35
+ && locale-gen
36
+ ENV LANG=en_US.UTF-8
37
+
38
+ RUN adduser --gecos '' --disabled-password coder \
39
+ && echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd
40
+
41
+ RUN ARCH="$(dpkg --print-architecture)" \
42
+ && 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 - \
43
+ && chown root:root /usr/local/bin/fixuid \
44
+ && chmod 4755 /usr/local/bin/fixuid \
45
+ && mkdir -p /etc/fixuid \
46
+ && printf "user: coder\ngroup: coder\n" > /etc/fixuid/config.yml
47
 
48
+ COPY ci/release-image/entrypoint.sh /usr/bin/entrypoint.sh
49
+ RUN --mount=from=packages,src=/tmp,dst=/tmp/packages dpkg -i /tmp/packages/code-server*$(dpkg --print-architecture).deb
50
 
51
+ # Allow users to have scripts run on container startup to prepare workspace.
52
+ # https://github.com/coder/code-server/issues/5177
53
+ ENV ENTRYPOINTD=${HOME}/entrypoint.d
54
 
55
+ EXPOSE 8080
56
+ # This way, if someone sets $DOCKER_USER, docker-exec will still work as
57
+ # the uid will remain the same. note: only relevant if -u isn't passed to
58
+ # docker-run.
59
+ USER 1000
60
+ ENV USER=coder
61
+ WORKDIR /home/coder
62
+ ENTRYPOINT ["/usr/bin/entrypoint.sh", "--bind-addr", "0.0.0.0:8080", "."]