Skip to content

Commit 9446cc8

Browse files
committed
Update Dockerfile
1 parent 68c6208 commit 9446cc8

File tree

7 files changed

+35
-24
lines changed

7 files changed

+35
-24
lines changed

.dockerignore

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
Dockerfile
2-
# Docs
32
doc/
4-
# GitHub stuff
53
.github
64
.gitignore
75
.travis.yml

.node-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
10.15.1
1+
10.16.0

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: node_js
22
node_js:
3-
- 10.15.1
3+
- 10.16.0
44
services:
55
- docker
66
matrix:

Dockerfile

+19-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
FROM node:10.15.1
1+
FROM node:10.16.0
2+
ARG codeServerVersion=docker
3+
ARG vscodeVersion
24

35
# Install VS Code's deps. These are the only two it seems we need.
46
RUN apt-get update && apt-get install -y \
@@ -11,9 +13,14 @@ RUN npm install -g yarn@1.13
1113
WORKDIR /src
1214
COPY . .
1315

14-
# In the future, we can use https://github.com/yarnpkg/rfcs/pull/53 to make yarn use the node_modules
15-
# directly which should be fast as it is slow because it populates its own cache every time.
16-
RUN yarn && NODE_ENV=production yarn task build:server:binary
16+
17+
# In the future, we can use https://github.com/yarnpkg/rfcs/pull/53 to make
18+
# yarn use the node_modules directly which should be fast as it is slow because
19+
# it populates its own cache every time.
20+
RUN yarn \
21+
&& yarn build "${codeServerVersion}" "${vscodeVersion}" linux x64 \
22+
&& yarn binary "${codeServerVersion}" "${vscodeVersion}" linux x64 \
23+
&& mv "/src/build/code-server${codeServerVersion}-vsc${vscodeVersion}-linux-x64" /src/build/code-server
1724

1825
# We deploy with ubuntu so that devs have a familiar environment.
1926
FROM ubuntu:18.04
@@ -30,24 +37,26 @@ RUN apt-get update && apt-get install -y \
3037
wget
3138

3239
RUN locale-gen en_US.UTF-8
33-
# We unfortunately cannot use update-locale because docker will not use the env variables
40+
# We cannot use update-locale because docker will not use the env variables
3441
# configured in /etc/default/locale so we need to set it manually.
3542
ENV LC_ALL=en_US.UTF-8
3643

3744
RUN adduser --gecos '' --disabled-password coder && \
3845
echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd
3946

4047
USER coder
41-
# We create first instead of just using WORKDIR as when WORKDIR creates, the user is root.
48+
# We create first instead of just using WORKDIR as when WORKDIR creates, the
49+
# user is root.
4250
RUN mkdir -p /home/coder/project
4351

4452
WORKDIR /home/coder/project
4553

46-
# This assures we have a volume mounted even if the user forgot to do bind mount.
47-
# So that they do not lose their data if they delete the container.
54+
# This ensures we have a volume mounted even if the user forgot to do bind
55+
# mount. So that they do not lose their data if they delete the container.
4856
VOLUME [ "/home/coder/project" ]
4957

50-
COPY --from=0 /src/packages/server/cli-linux-x64 /usr/local/bin/code-server
58+
COPY --from=0 /src/build/code-server /usr/local/bin/code-server
5159
EXPOSE 8443
60+
EXPOSE 8444
5261

53-
ENTRYPOINT ["dumb-init", "code-server"]
62+
ENTRYPOINT ["dumb-init", "code-server", "--host", "0.0.0.0"]

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ remote server, accessible through the browser.
1010

1111
Try it out:
1212
```bash
13-
docker run -it -p 127.0.0.1:8443:8443 -v "${PWD}:/home/coder/project" codercom/code-server --allow-http --no-auth
13+
docker run -it -p 127.0.0.1:8443:8443 -p 127.0.0.1:8444:8444 -v "$PWD:/home/coder/project" codercom/code-server --allow-http --no-auth
1414
```
1515

1616
- Code on your Chromebook, tablet, and laptop with a consistent dev environment.
@@ -59,9 +59,9 @@ Quickstart guides for [Google Cloud](doc/admin/install/google_cloud.md),
5959
How to [secure your setup](/doc/security/ssl.md).
6060

6161
### Build
62-
- If you also plan on developing, set the `OUT` environment variable: `
63-
export OUT=/path/to/some/directory`. Otherwise it will build in this
64-
directory which will cause issues because then `yarn watch` will try to
62+
- If you also plan on developing, set the `OUT` environment variable:
63+
`export OUT=/path/to/some/directory`. Otherwise it will build in this
64+
directory which will cause issues because `yarn watch` will try to
6565
compile the build directory as well.
6666
- For now `@coder/nbin` is a global dependency.
6767
- Run `yarn build ${codeServerVersion} ${vscodeVersion} ${target} ${arch}` in

scripts/ci.bash

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ function docker-build() {
1616
# TODO: temporary as long as we are rebuilding modules.
1717
if [[ "${image}" == "codercom/nbin-alpine" ]] ; then
1818
docker exec "${containerId}" apk add libxkbfile-dev libsecret-dev
19+
else
20+
docker exec "${containerId}" yum install -y libxkbfile-devel libsecret-devel
1921
fi
2022

2123
function docker-exec() {

scripts/tasks.bash

+8-6
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,13 @@ function build-code-server() {
9494
rm -rf "${codeServerBuildPath}/out/vs/server/typings"
9595

9696
# Rebuild to make sure the native modules work since at the moment all the
97-
# pre-built packages are from one Linux system. This means you must build on
98-
# the target system.
97+
# pre-built packages are from one Linux system which compiles against the
98+
# latest glibc. This means you must build on the target system.
9999
log "Installing remote dependencies"
100100
cd "${vscodeSourcePath}/remote"
101-
if [[ "${target}" != "linux" ]] ; then
102-
yarn --production --force
103-
fi
101+
# TODO: vscode-ripgrep errors saying node_modules doesn't exist.
102+
# TODO: yarn --force should be the same but it doesn't fix it.
103+
npm rebuild || true
104104
cp -r "${vscodeSourcePath}/remote/node_modules" "${codeServerBuildPath}"
105105

106106
# Only keep the production dependencies.
@@ -133,7 +133,9 @@ function build-vscode() {
133133
log "Installing VS Code dependencies"
134134
# Not entirely sure why but there seem to be problems with native modules
135135
# so rebuild them.
136-
yarn --force
136+
# TODO: vscode-ripgrep errors saying node_modules doesn't exist.
137+
# TODO: yarn --force should be the same but it'.
138+
npm rebuild || true
137139

138140
# Keep just what we need to keep the pre-built archive smaller.
139141
rm -rf "${vscodeSourcePath}/test"

0 commit comments

Comments
 (0)