Update Dockerfile
Browse files- Dockerfile +38 -15
Dockerfile
CHANGED
|
@@ -1,7 +1,15 @@
|
|
| 1 |
-
#
|
| 2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
-
#
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
-
|
| 31 |
-
RUN
|
| 32 |
|
| 33 |
-
#
|
| 34 |
-
|
|
|
|
| 35 |
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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", "."]
|