Merge pull request #433 from codercom/docker-fixes
Significantly improve the Dockerfile
This commit is contained in:
commit
6737d3da18
25
Dockerfile
25
Dockerfile
@ -16,19 +16,30 @@ COPY . .
|
||||
RUN yarn && NODE_ENV=production yarn task build:server:binary
|
||||
|
||||
# We deploy with ubuntu so that devs have a familiar environment.
|
||||
FROM ubuntu:18.10
|
||||
WORKDIR /root/project
|
||||
COPY --from=0 /src/packages/server/cli-linux-x64 /usr/local/bin/code-server
|
||||
EXPOSE 8443
|
||||
FROM ubuntu:18.04
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
openssl \
|
||||
net-tools \
|
||||
git \
|
||||
locales
|
||||
locales \
|
||||
sudo \
|
||||
dumb-init
|
||||
|
||||
RUN locale-gen en_US.UTF-8
|
||||
# We unfortunately cannot use update-locale because docker will not use the env variables
|
||||
# configured in /etc/default/locale so we need to set it manually.
|
||||
ENV LANG=en_US.UTF-8
|
||||
ENV LC_ALL=en_US.UTF-8
|
||||
ENTRYPOINT ["code-server"]
|
||||
|
||||
RUN adduser --gecos '' --disabled-password coder
|
||||
RUN echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd
|
||||
|
||||
USER coder
|
||||
# We create first instead of just using WORKDIR as when WORKDIR creates, the user is root.
|
||||
RUN mkdir -p /home/coder/project
|
||||
WORKDIR /home/coder/project
|
||||
|
||||
COPY --from=0 /src/packages/server/cli-linux-x64 /usr/local/bin/code-server
|
||||
EXPOSE 8443
|
||||
|
||||
ENTRYPOINT ["dumb-init", "code-server"]
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
Try it out:
|
||||
```bash
|
||||
docker run -t -p 127.0.0.1:8443:8443 -v "${PWD}:/root/project" codercom/code-server code-server --allow-http --no-auth
|
||||
docker run -it -p 127.0.0.1:8443:8443 -v "${PWD}:/home/coder/project" codercom/code-server:1.621 --allow-http --no-auth
|
||||
```
|
||||
|
||||
- Code on your Chromebook, tablet, and laptop with a consistent dev environment.
|
||||
|
Loading…
Reference in New Issue
Block a user