Skip to content

Commit 6737d3d

Browse files
authored
Merge pull request #433 from codercom/docker-fixes
Significantly improve the Dockerfile
2 parents e73eb74 + eb0f773 commit 6737d3d

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

Dockerfile

+18-7
Original file line numberDiff line numberDiff line change
@@ -16,19 +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-
WORKDIR /root/project
21-
COPY --from=0 /src/packages/server/cli-linux-x64 /usr/local/bin/code-server
22-
EXPOSE 8443
19+
FROM ubuntu:18.04
2320

2421
RUN apt-get update && apt-get install -y \
2522
openssl \
2623
net-tools \
2724
git \
28-
locales
25+
locales \
26+
sudo \
27+
dumb-init
28+
2929
RUN locale-gen en_US.UTF-8
3030
# We unfortunately cannot use update-locale because docker will not use the env variables
3131
# configured in /etc/default/locale so we need to set it manually.
32-
ENV LANG=en_US.UTF-8
3332
ENV LC_ALL=en_US.UTF-8
34-
ENTRYPOINT ["code-server"]
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"]

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
Try it out:
1111
```bash
12-
docker run -t -p 127.0.0.1:8443:8443 -v "${PWD}:/root/project" codercom/code-server code-server --allow-http --no-auth
12+
docker run -it -p 127.0.0.1:8443:8443 -v "${PWD}:/home/coder/project" codercom/code-server:1.621 --allow-http --no-auth
1313
```
1414

1515
- Code on your Chromebook, tablet, and laptop with a consistent dev environment.

0 commit comments

Comments
 (0)