Skip to content

Commit d705cdc

Browse files
committed
Add custom docker build
1 parent 362715b commit d705cdc

File tree

4 files changed

+127
-93
lines changed

4 files changed

+127
-93
lines changed

.travis.yml

Lines changed: 6 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,8 @@
1-
language: node_js
2-
node_js:
3-
- 10.15.1
1+
sudo: required
42
services:
5-
- docker
6-
matrix:
7-
include:
8-
- os: linux
9-
dist: trusty
10-
env:
11-
- VSCODE_VERSION="1.33.1" MAJOR_VERSION="1" VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER-vsc$VSCODE_VERSION" TARGET="centos"
12-
- os: linux
13-
dist: trusty
14-
env:
15-
- VSCODE_VERSION="1.33.1" MAJOR_VERSION="1" VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER-vsc$VSCODE_VERSION" TARGET="alpine"
16-
- os: osx
17-
env:
18-
- VSCODE_VERSION="1.33.1" MAJOR_VERSION="1" VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER-vsc$VSCODE_VERSION"
19-
before_install:
20-
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libxkbfile-dev
21-
libsecret-1-dev; fi
22-
- npm install -g [email protected]
3+
- docker
4+
235
script:
24-
- scripts/build.sh
25-
before_deploy:
26-
- echo "$VERSION" "$TRAVIS_COMMIT"
27-
- git config --local user.name "$USER_NAME"
28-
- git config --local user.email "$USER_EMAIL"
29-
- git tag "$VERSION" "$TRAVIS_COMMIT"
30-
deploy:
31-
provider: releases
32-
file_glob: true
33-
draft: true
34-
tag_name: "$VERSION"
35-
target_commitish: "$TRAVIS_COMMIT"
36-
name: "$VERSION"
37-
skip_cleanup: true
38-
api_key:
39-
secure: YL/x24KjYjgYXPcJWk3FV7FGxI79Mh6gBECQEcdlf3fkLEoKFVgzHBoUNWrFPzyR4tgLyWNAgcpD9Lkme1TRWTom7UPjXcwMNyLcLa+uec7ciSAnYD9ntLTpiCuPDD1u0LtRGclSi/EHQ+F8YVq+HZJpXTsJeAmOmihma3GVbGKSZr+BRum+0YZSG4w+o4TOlYzw/4bLWS52MogZcwpjd+hemBbgXLuGU2ziKv2vEKCZFbEeA16II4x1WLI4mutDdCeh7+3aLzGLwDa49NxtsVYNjyNFF75JhCTCNA55e2YMiLz9Uq69IXe/mi5F7xUaFfhIqqLNyKBnKeEOzu3dYnc+8n3LjnQ+00PmkF05nx9kBn3UfV1kwQGh6QbyDmTtBP07rtUMyI14aeQqHjxsaVRdMnwj9Q2DjXRr8UDqESZF0rmK3pHCXS2fBhIzLE8tLVW5Heiba2pQRFMHMZW+KBE97FzcFh7is90Ait3T8enfcd/PWFPYoBejDAdjwxwOkezh5N5ZkYquEfDYuWrFi6zRFCktsruaAcA+xGtTf9oilBBzUqu8Ie+YFWH5me83xakcblJWdaW/D2rLJAJH3m6LFm8lBqyUgDX5t/etob6CpDuYHu5D1J3XINOj/+aLAcadq6qlh70PMZS3zYffUu3JlzaD2amlSHIT8b5YXFc=
40-
file:
41-
- release/*.tar.gz
42-
- release/*.zip
43-
on:
44-
repo: cdr/code-server
45-
branch: master
46-
cache:
47-
yarn: true
48-
timeout: 1000
49-
directories:
50-
- .cache
6+
- docker build -t jasonrey/code-server-with-docker .
7+
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
8+
- docker push jasonrey/code-server-with-docker

.travis.yml.orig

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
language: node_js
2+
node_js:
3+
- 10.15.1
4+
services:
5+
- docker
6+
matrix:
7+
include:
8+
- os: linux
9+
dist: trusty
10+
env:
11+
- VSCODE_VERSION="1.33.1" MAJOR_VERSION="1" VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER-vsc$VSCODE_VERSION" TARGET="centos"
12+
- os: linux
13+
dist: trusty
14+
env:
15+
- VSCODE_VERSION="1.33.1" MAJOR_VERSION="1" VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER-vsc$VSCODE_VERSION" TARGET="alpine"
16+
- os: osx
17+
env:
18+
- VSCODE_VERSION="1.33.1" MAJOR_VERSION="1" VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER-vsc$VSCODE_VERSION"
19+
before_install:
20+
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libxkbfile-dev
21+
libsecret-1-dev; fi
22+
- npm install -g [email protected]
23+
script:
24+
- scripts/build.sh
25+
before_deploy:
26+
- echo "$VERSION" "$TRAVIS_COMMIT"
27+
- git config --local user.name "$USER_NAME"
28+
- git config --local user.email "$USER_EMAIL"
29+
- git tag "$VERSION" "$TRAVIS_COMMIT"
30+
deploy:
31+
provider: releases
32+
file_glob: true
33+
draft: true
34+
tag_name: "$VERSION"
35+
target_commitish: "$TRAVIS_COMMIT"
36+
name: "$VERSION"
37+
skip_cleanup: true
38+
api_key:
39+
secure: YL/x24KjYjgYXPcJWk3FV7FGxI79Mh6gBECQEcdlf3fkLEoKFVgzHBoUNWrFPzyR4tgLyWNAgcpD9Lkme1TRWTom7UPjXcwMNyLcLa+uec7ciSAnYD9ntLTpiCuPDD1u0LtRGclSi/EHQ+F8YVq+HZJpXTsJeAmOmihma3GVbGKSZr+BRum+0YZSG4w+o4TOlYzw/4bLWS52MogZcwpjd+hemBbgXLuGU2ziKv2vEKCZFbEeA16II4x1WLI4mutDdCeh7+3aLzGLwDa49NxtsVYNjyNFF75JhCTCNA55e2YMiLz9Uq69IXe/mi5F7xUaFfhIqqLNyKBnKeEOzu3dYnc+8n3LjnQ+00PmkF05nx9kBn3UfV1kwQGh6QbyDmTtBP07rtUMyI14aeQqHjxsaVRdMnwj9Q2DjXRr8UDqESZF0rmK3pHCXS2fBhIzLE8tLVW5Heiba2pQRFMHMZW+KBE97FzcFh7is90Ait3T8enfcd/PWFPYoBejDAdjwxwOkezh5N5ZkYquEfDYuWrFi6zRFCktsruaAcA+xGtTf9oilBBzUqu8Ie+YFWH5me83xakcblJWdaW/D2rLJAJH3m6LFm8lBqyUgDX5t/etob6CpDuYHu5D1J3XINOj/+aLAcadq6qlh70PMZS3zYffUu3JlzaD2amlSHIT8b5YXFc=
40+
file:
41+
- release/*.tar.gz
42+
- release/*.zip
43+
on:
44+
repo: cdr/code-server
45+
branch: master
46+
cache:
47+
yarn: true
48+
timeout: 1000
49+
directories:
50+
- .cache

Dockerfile

Lines changed: 18 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,26 @@
1-
FROM node:10.15.1
1+
FROM codercom/code-server
22

3-
# Install VS Code's deps. These are the only two it seems we need.
4-
RUN apt-get update && apt-get install -y \
5-
libxkbfile-dev \
6-
libsecret-1-dev
3+
RUN sudo apt-get update && sudo apt-get -y install \
4+
apt-transport-https \
5+
ca-certificates \
6+
curl \
7+
gnupg-agent \
8+
software-properties-common
79

8-
# Ensure latest yarn.
9-
RUN npm install -g [email protected]
10+
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
1011

11-
WORKDIR /src
12-
COPY . .
12+
RUN sudo apt-key fingerprint 0EBFCD88 && sudo add-apt-repository \
13+
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
14+
$(lsb_release -cs) \
15+
stable"
1316

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
17+
RUN sudo apt-get update && sudo apt-get install -y docker-ce-cli
1718

18-
# We deploy with ubuntu so that devs have a familiar environment.
19-
FROM ubuntu:18.04
19+
USER root
2020

21-
RUN apt-get update && apt-get install -y \
22-
openssl \
23-
net-tools \
24-
git \
25-
locales \
26-
sudo \
27-
dumb-init \
28-
vim \
29-
curl \
30-
wget
21+
WORKDIR /projects
3122

32-
RUN locale-gen en_US.UTF-8
33-
# We unfortunately cannot use update-locale because docker will not use the env variables
34-
# configured in /etc/default/locale so we need to set it manually.
35-
ENV LC_ALL=en_US.UTF-8
23+
VOLUME /var/run/docker.sock
24+
VOLUME /projects
3625

37-
RUN adduser --gecos '' --disabled-password coder && \
38-
echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd
39-
40-
USER coder
41-
# We create first instead of just using WORKDIR as when WORKDIR creates, the user is root.
42-
RUN mkdir -p /home/coder/project
43-
44-
WORKDIR /home/coder/project
45-
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.
48-
VOLUME [ "/home/coder/project" ]
49-
50-
COPY --from=0 /src/packages/server/cli-linux-x64 /usr/local/bin/code-server
51-
EXPOSE 8443
52-
53-
ENTRYPOINT ["dumb-init", "code-server"]
26+
ENV color_prompt yes

Dockerfile.orig

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
FROM node:10.15.1
2+
3+
# Install VS Code's deps. These are the only two it seems we need.
4+
RUN apt-get update && apt-get install -y \
5+
libxkbfile-dev \
6+
libsecret-1-dev
7+
8+
# Ensure latest yarn.
9+
RUN npm install -g [email protected]
10+
11+
WORKDIR /src
12+
COPY . .
13+
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
17+
18+
# We deploy with ubuntu so that devs have a familiar environment.
19+
FROM ubuntu:18.04
20+
21+
RUN apt-get update && apt-get install -y \
22+
openssl \
23+
net-tools \
24+
git \
25+
locales \
26+
sudo \
27+
dumb-init \
28+
vim \
29+
curl \
30+
wget
31+
32+
RUN locale-gen en_US.UTF-8
33+
# We unfortunately cannot use update-locale because docker will not use the env variables
34+
# configured in /etc/default/locale so we need to set it manually.
35+
ENV LC_ALL=en_US.UTF-8
36+
37+
RUN adduser --gecos '' --disabled-password coder && \
38+
echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd
39+
40+
USER coder
41+
# We create first instead of just using WORKDIR as when WORKDIR creates, the user is root.
42+
RUN mkdir -p /home/coder/project
43+
44+
WORKDIR /home/coder/project
45+
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.
48+
VOLUME [ "/home/coder/project" ]
49+
50+
COPY --from=0 /src/packages/server/cli-linux-x64 /usr/local/bin/code-server
51+
EXPOSE 8443
52+
53+
ENTRYPOINT ["dumb-init", "code-server"]

0 commit comments

Comments
 (0)