Skip to content

Commit 54cf52c

Browse files
committed
Significantly improve the Dockerfile
- Adds dumb-init so closes #403, closes #361, closes #383 - User mode docker so closes #192, closes #65 - Uses latest docker ubuntu instead of 18.10 which is the rolling tag so closes #404 Thanks to @RichardMcSorley and @sr229
1 parent 455f13c commit 54cf52c

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

Dockerfile

+17-9
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,30 @@ COPY . .
1616
RUN yarn && NODE_ENV=production yarn task build:server:binary
1717

1818
# We deploy with ubuntu so that devs have a familiar environment.
19-
FROM ubuntu:18.10
20-
# We unfortunately cannot use update-locale because docker will not use the env variables
21-
# configured in /etc/default/locale so we need to set it manually.
22-
ENV LANG=en_US.UTF-8 \
23-
LC_ALL=en_US.UTF-8;
19+
FROM ubuntu:18.04
2420

25-
COPY --from=0 /src/packages/server/cli-linux-x64 /usr/local/bin/code-server
2621
RUN apt-get update && apt-get install -y \
2722
openssl \
2823
net-tools \
2924
git \
3025
locales \
26+
sudo \
3127
dumb-init
28+
3229
RUN locale-gen en_US.UTF-8
3330
# We unfortunately cannot use update-locale because docker will not use the env variables
3431
# configured in /etc/default/locale so we need to set it manually.
35-
ENV LANG=en_US.UTF-8
36-
ENV LC_ALL=en_US.UTF-8
37-
ENTRYPOINT ["/usr/bin/dumb-init", "code-server"]
32+
ENV LC_ALL=en_US.UTF-8
33+
34+
RUN adduser --gecos '' --disabled-password coder
35+
RUN echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd
36+
37+
USER coder
38+
# We create first instead of just using WORKDIR as when WORKDIR creates, the user is root.
39+
RUN mkdir -p /home/coder/project
40+
WORKDIR /home/coder/project
41+
42+
COPY --from=0 /src/packages/server/cli-linux-x64 /usr/local/bin/code-server
43+
EXPOSE 8443
44+
45+
ENTRYPOINT ["dumb-init", "code-server"]

0 commit comments

Comments
 (0)