diff --git a/.travis.yml b/.travis.yml index 828655abf2e6..2b5230aabc14 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,50 +1,8 @@ -language: node_js -node_js: -- 10.15.1 +sudo: required services: -- docker -matrix: - include: - - os: linux - dist: trusty - env: - - VSCODE_VERSION="1.33.1" MAJOR_VERSION="1" VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER-vsc$VSCODE_VERSION" TARGET="centos" - - os: linux - dist: trusty - env: - - VSCODE_VERSION="1.33.1" MAJOR_VERSION="1" VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER-vsc$VSCODE_VERSION" TARGET="alpine" - - os: osx - env: - - VSCODE_VERSION="1.33.1" MAJOR_VERSION="1" VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER-vsc$VSCODE_VERSION" -before_install: -- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libxkbfile-dev - libsecret-1-dev; fi -- npm install -g yarn@1.12.3 + - docker + script: -- scripts/build.sh -before_deploy: -- echo "$VERSION" "$TRAVIS_COMMIT" -- git config --local user.name "$USER_NAME" -- git config --local user.email "$USER_EMAIL" -- git tag "$VERSION" "$TRAVIS_COMMIT" -deploy: - provider: releases - file_glob: true - draft: true - tag_name: "$VERSION" - target_commitish: "$TRAVIS_COMMIT" - name: "$VERSION" - skip_cleanup: true - api_key: - secure: YL/x24KjYjgYXPcJWk3FV7FGxI79Mh6gBECQEcdlf3fkLEoKFVgzHBoUNWrFPzyR4tgLyWNAgcpD9Lkme1TRWTom7UPjXcwMNyLcLa+uec7ciSAnYD9ntLTpiCuPDD1u0LtRGclSi/EHQ+F8YVq+HZJpXTsJeAmOmihma3GVbGKSZr+BRum+0YZSG4w+o4TOlYzw/4bLWS52MogZcwpjd+hemBbgXLuGU2ziKv2vEKCZFbEeA16II4x1WLI4mutDdCeh7+3aLzGLwDa49NxtsVYNjyNFF75JhCTCNA55e2YMiLz9Uq69IXe/mi5F7xUaFfhIqqLNyKBnKeEOzu3dYnc+8n3LjnQ+00PmkF05nx9kBn3UfV1kwQGh6QbyDmTtBP07rtUMyI14aeQqHjxsaVRdMnwj9Q2DjXRr8UDqESZF0rmK3pHCXS2fBhIzLE8tLVW5Heiba2pQRFMHMZW+KBE97FzcFh7is90Ait3T8enfcd/PWFPYoBejDAdjwxwOkezh5N5ZkYquEfDYuWrFi6zRFCktsruaAcA+xGtTf9oilBBzUqu8Ie+YFWH5me83xakcblJWdaW/D2rLJAJH3m6LFm8lBqyUgDX5t/etob6CpDuYHu5D1J3XINOj/+aLAcadq6qlh70PMZS3zYffUu3JlzaD2amlSHIT8b5YXFc= - file: - - release/*.tar.gz - - release/*.zip - on: - repo: cdr/code-server - branch: master -cache: - yarn: true - timeout: 1000 - directories: - - .cache + - docker build -t jasonrey/code-server-with-docker . + - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin + - docker push jasonrey/code-server-with-docker diff --git a/.travis.yml.orig b/.travis.yml.orig new file mode 100644 index 000000000000..828655abf2e6 --- /dev/null +++ b/.travis.yml.orig @@ -0,0 +1,50 @@ +language: node_js +node_js: +- 10.15.1 +services: +- docker +matrix: + include: + - os: linux + dist: trusty + env: + - VSCODE_VERSION="1.33.1" MAJOR_VERSION="1" VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER-vsc$VSCODE_VERSION" TARGET="centos" + - os: linux + dist: trusty + env: + - VSCODE_VERSION="1.33.1" MAJOR_VERSION="1" VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER-vsc$VSCODE_VERSION" TARGET="alpine" + - os: osx + env: + - VSCODE_VERSION="1.33.1" MAJOR_VERSION="1" VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER-vsc$VSCODE_VERSION" +before_install: +- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libxkbfile-dev + libsecret-1-dev; fi +- npm install -g yarn@1.12.3 +script: +- scripts/build.sh +before_deploy: +- echo "$VERSION" "$TRAVIS_COMMIT" +- git config --local user.name "$USER_NAME" +- git config --local user.email "$USER_EMAIL" +- git tag "$VERSION" "$TRAVIS_COMMIT" +deploy: + provider: releases + file_glob: true + draft: true + tag_name: "$VERSION" + target_commitish: "$TRAVIS_COMMIT" + name: "$VERSION" + skip_cleanup: true + api_key: + secure: YL/x24KjYjgYXPcJWk3FV7FGxI79Mh6gBECQEcdlf3fkLEoKFVgzHBoUNWrFPzyR4tgLyWNAgcpD9Lkme1TRWTom7UPjXcwMNyLcLa+uec7ciSAnYD9ntLTpiCuPDD1u0LtRGclSi/EHQ+F8YVq+HZJpXTsJeAmOmihma3GVbGKSZr+BRum+0YZSG4w+o4TOlYzw/4bLWS52MogZcwpjd+hemBbgXLuGU2ziKv2vEKCZFbEeA16II4x1WLI4mutDdCeh7+3aLzGLwDa49NxtsVYNjyNFF75JhCTCNA55e2YMiLz9Uq69IXe/mi5F7xUaFfhIqqLNyKBnKeEOzu3dYnc+8n3LjnQ+00PmkF05nx9kBn3UfV1kwQGh6QbyDmTtBP07rtUMyI14aeQqHjxsaVRdMnwj9Q2DjXRr8UDqESZF0rmK3pHCXS2fBhIzLE8tLVW5Heiba2pQRFMHMZW+KBE97FzcFh7is90Ait3T8enfcd/PWFPYoBejDAdjwxwOkezh5N5ZkYquEfDYuWrFi6zRFCktsruaAcA+xGtTf9oilBBzUqu8Ie+YFWH5me83xakcblJWdaW/D2rLJAJH3m6LFm8lBqyUgDX5t/etob6CpDuYHu5D1J3XINOj/+aLAcadq6qlh70PMZS3zYffUu3JlzaD2amlSHIT8b5YXFc= + file: + - release/*.tar.gz + - release/*.zip + on: + repo: cdr/code-server + branch: master +cache: + yarn: true + timeout: 1000 + directories: + - .cache diff --git a/Dockerfile b/Dockerfile index 0610301a3fb3..99b8466cf1e3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,53 +1,26 @@ -FROM node:10.15.1 +FROM codercom/code-server -# Install VS Code's deps. These are the only two it seems we need. -RUN apt-get update && apt-get install -y \ - libxkbfile-dev \ - libsecret-1-dev +RUN sudo apt-get update && sudo apt-get -y install \ + apt-transport-https \ + ca-certificates \ + curl \ + gnupg-agent \ + software-properties-common -# Ensure latest yarn. -RUN npm install -g yarn@1.13 +RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - -WORKDIR /src -COPY . . +RUN sudo apt-key fingerprint 0EBFCD88 && sudo add-apt-repository \ + "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ + $(lsb_release -cs) \ + stable" -# In the future, we can use https://github.com/yarnpkg/rfcs/pull/53 to make yarn use the node_modules -# directly which should be fast as it is slow because it populates its own cache every time. -RUN yarn && NODE_ENV=production yarn task build:server:binary +RUN sudo apt-get update && sudo apt-get install -y docker-ce-cli -# We deploy with ubuntu so that devs have a familiar environment. -FROM ubuntu:18.04 +USER root -RUN apt-get update && apt-get install -y \ - openssl \ - net-tools \ - git \ - locales \ - sudo \ - dumb-init \ - vim \ - curl \ - wget +WORKDIR /projects -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 LC_ALL=en_US.UTF-8 +VOLUME /var/run/docker.sock +VOLUME /projects -RUN adduser --gecos '' --disabled-password coder && \ - 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 - -# This assures we have a volume mounted even if the user forgot to do bind mount. -# So that they do not lose their data if they delete the container. -VOLUME [ "/home/coder/project" ] - -COPY --from=0 /src/packages/server/cli-linux-x64 /usr/local/bin/code-server -EXPOSE 8443 - -ENTRYPOINT ["dumb-init", "code-server"] +ENV color_prompt yes diff --git a/Dockerfile.orig b/Dockerfile.orig new file mode 100644 index 000000000000..0610301a3fb3 --- /dev/null +++ b/Dockerfile.orig @@ -0,0 +1,53 @@ +FROM node:10.15.1 + +# Install VS Code's deps. These are the only two it seems we need. +RUN apt-get update && apt-get install -y \ + libxkbfile-dev \ + libsecret-1-dev + +# Ensure latest yarn. +RUN npm install -g yarn@1.13 + +WORKDIR /src +COPY . . + +# In the future, we can use https://github.com/yarnpkg/rfcs/pull/53 to make yarn use the node_modules +# directly which should be fast as it is slow because it populates its own cache every time. +RUN yarn && NODE_ENV=production yarn task build:server:binary + +# We deploy with ubuntu so that devs have a familiar environment. +FROM ubuntu:18.04 + +RUN apt-get update && apt-get install -y \ + openssl \ + net-tools \ + git \ + locales \ + sudo \ + dumb-init \ + vim \ + curl \ + wget + +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 LC_ALL=en_US.UTF-8 + +RUN adduser --gecos '' --disabled-password coder && \ + 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 + +# This assures we have a volume mounted even if the user forgot to do bind mount. +# So that they do not lose their data if they delete the container. +VOLUME [ "/home/coder/project" ] + +COPY --from=0 /src/packages/server/cli-linux-x64 /usr/local/bin/code-server +EXPOSE 8443 + +ENTRYPOINT ["dumb-init", "code-server"]