From a1fa7f021e53f4c68fafcff99b42c8f2160c1258 Mon Sep 17 00:00:00 2001 From: aptalca Date: Sun, 20 Feb 2022 15:51:53 -0500 Subject: [PATCH] install using official debs --- .github/workflows/external_trigger.yml | 2 +- Dockerfile | 47 ++++---------------------- Dockerfile.aarch64 | 47 ++++---------------------- Dockerfile.armhf | 47 ++++---------------------- Jenkinsfile | 2 +- README.md | 1 + jenkins-vars.yml | 2 +- readme-vars.yml | 1 + root/etc/services.d/code-server/run | 2 +- 9 files changed, 24 insertions(+), 127 deletions(-) diff --git a/.github/workflows/external_trigger.yml b/.github/workflows/external_trigger.yml index 8385449..4035f31 100644 --- a/.github/workflows/external_trigger.yml +++ b/.github/workflows/external_trigger.yml @@ -18,7 +18,7 @@ jobs: fi echo "**** External trigger running off of master branch. To disable this trigger, set a Github secret named \"PAUSE_EXTERNAL_TRIGGER_CODE_SERVER_MASTER\". ****" echo "**** Retrieving external version ****" - EXT_RELEASE=$(curl -sX GET https://registry.yarnpkg.com/code-server | jq -r '."dist-tags".latest' | sed 's|^|v|') + EXT_RELEASE=$(curl -u ${{ secrets.CR_USER }}:${{ secrets.CR_PAT }} -sX GET https://api.github.com/repos/coder/code-server/releases/latest | jq -r '.tag_name' | sed 's|^v||') if [ -z "${EXT_RELEASE}" ] || [ "${EXT_RELEASE}" == "null" ]; then echo "**** Can't retrieve external version, exiting ****" FAILURE_REASON="Can't retrieve external version for code-server branch master" diff --git a/Dockerfile b/Dockerfile index 25ea3af..2aa9e59 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,51 +11,16 @@ LABEL maintainer="aptalca" ENV HOME="/config" RUN \ - echo "**** install node repo ****" && \ - apt-get update && \ - apt-get install -y \ - gnupg && \ - curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \ - echo 'deb https://deb.nodesource.com/node_14.x focal main' \ - > /etc/apt/sources.list.d/nodesource.list && \ - curl -s https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ - echo 'deb https://dl.yarnpkg.com/debian/ stable main' \ - > /etc/apt/sources.list.d/yarn.list && \ - echo "**** install build dependencies ****" && \ - apt-get update && \ - apt-get install -y \ - build-essential \ - libx11-dev \ - libxkbfile-dev \ - pkg-config \ - python3 && \ - echo "**** install runtime dependencies ****" && \ - apt-get install -y \ - git \ - jq \ - nano \ - net-tools \ - nodejs \ - sudo \ - yarn && \ echo "**** install code-server ****" && \ if [ -z ${CODE_RELEASE+x} ]; then \ - CODE_RELEASE=$(curl -sX GET https://registry.yarnpkg.com/code-server \ - | jq -r '."dist-tags".latest' | sed 's|^|v|'); \ + CODE_RELEASE=$(curl -sX GET https://api.github.com/repos/coder/code-server/releases/latest \ + | awk '/tag_name/{print $4;exit}' FS='[""]' | sed 's|^v||'); \ fi && \ - CODE_VERSION=$(echo "$CODE_RELEASE" | awk '{print substr($1,2); }') && \ - npm config set python python3 && \ - yarn config set network-timeout 600000 -g && \ - yarn --production --verbose --frozen-lockfile global add code-server@"$CODE_VERSION" && \ - yarn cache clean && \ + curl -o \ + /tmp/code-server.deb -L \ + "https://github.com/coder/code-server/releases/download/v${CODE_RELEASE}/code-server_${CODE_RELEASE}_amd64.deb" && \ + dpkg -i /tmp/code-server.deb && \ echo "**** clean up ****" && \ - apt-get purge --auto-remove -y \ - build-essential \ - libx11-dev \ - libxkbfile-dev \ - libsecret-1-dev \ - pkg-config && \ - apt-get clean && \ rm -rf \ /config/* \ /tmp/* \ diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index cd62947..38d1fde 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -11,51 +11,16 @@ LABEL maintainer="aptalca" ENV HOME="/config" RUN \ - echo "**** install node repo ****" && \ - apt-get update && \ - apt-get install -y \ - gnupg && \ - curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \ - echo 'deb https://deb.nodesource.com/node_14.x focal main' \ - > /etc/apt/sources.list.d/nodesource.list && \ - curl -s https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ - echo 'deb https://dl.yarnpkg.com/debian/ stable main' \ - > /etc/apt/sources.list.d/yarn.list && \ - echo "**** install build dependencies ****" && \ - apt-get update && \ - apt-get install -y \ - build-essential \ - libx11-dev \ - libxkbfile-dev \ - pkg-config \ - python3 && \ - echo "**** install runtime dependencies ****" && \ - apt-get install -y \ - git \ - jq \ - nano \ - net-tools \ - nodejs \ - sudo \ - yarn && \ echo "**** install code-server ****" && \ if [ -z ${CODE_RELEASE+x} ]; then \ - CODE_RELEASE=$(curl -sX GET https://registry.yarnpkg.com/code-server \ - | jq -r '."dist-tags".latest' | sed 's|^|v|'); \ + CODE_RELEASE=$(curl -sX GET https://api.github.com/repos/coder/code-server/releases/latest \ + | awk '/tag_name/{print $4;exit}' FS='[""]' | sed 's|^v||'); \ fi && \ - CODE_VERSION=$(echo "$CODE_RELEASE" | awk '{print substr($1,2); }') && \ - npm config set python python3 && \ - yarn config set network-timeout 600000 -g && \ - yarn --production --verbose --frozen-lockfile global add code-server@"$CODE_VERSION" && \ - yarn cache clean && \ + curl -o \ + /tmp/code-server.deb -L \ + "https://github.com/coder/code-server/releases/download/v${CODE_RELEASE}/code-server_${CODE_RELEASE}_arm64.deb" && \ + dpkg -i /tmp/code-server.deb && \ echo "**** clean up ****" && \ - apt-get purge --auto-remove -y \ - build-essential \ - libx11-dev \ - libxkbfile-dev \ - libsecret-1-dev \ - pkg-config && \ - apt-get clean && \ rm -rf \ /config/* \ /tmp/* \ diff --git a/Dockerfile.armhf b/Dockerfile.armhf index 9537b79..59d9d82 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -11,51 +11,16 @@ LABEL maintainer="aptalca" ENV HOME="/config" RUN \ - echo "**** install node repo ****" && \ - apt-get update && \ - apt-get install -y \ - gnupg && \ - curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \ - echo 'deb https://deb.nodesource.com/node_14.x focal main' \ - > /etc/apt/sources.list.d/nodesource.list && \ - curl -s https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ - echo 'deb https://dl.yarnpkg.com/debian/ stable main' \ - > /etc/apt/sources.list.d/yarn.list && \ - echo "**** install build dependencies ****" && \ - apt-get update && \ - apt-get install -y \ - build-essential \ - libx11-dev \ - libxkbfile-dev \ - pkg-config \ - python3 && \ - echo "**** install runtime dependencies ****" && \ - apt-get install -y \ - git \ - jq \ - nano \ - net-tools \ - nodejs \ - sudo \ - yarn && \ echo "**** install code-server ****" && \ if [ -z ${CODE_RELEASE+x} ]; then \ - CODE_RELEASE=$(curl -sX GET https://registry.yarnpkg.com/code-server \ - | jq -r '."dist-tags".latest' | sed 's|^|v|'); \ + CODE_RELEASE=$(curl -sX GET https://api.github.com/repos/coder/code-server/releases/latest \ + | awk '/tag_name/{print $4;exit}' FS='[""]' | sed 's|^v||'); \ fi && \ - CODE_VERSION=$(echo "$CODE_RELEASE" | awk '{print substr($1,2); }') && \ - npm config set python python3 && \ - yarn config set network-timeout 600000 -g && \ - yarn --production --verbose --frozen-lockfile global add code-server@"$CODE_VERSION" && \ - yarn cache clean && \ + curl -o \ + /tmp/code-server.deb -L \ + "https://github.com/coder/code-server/releases/download/v${CODE_RELEASE}/code-server_${CODE_RELEASE}_armhf.deb" && \ + dpkg -i /tmp/code-server.deb && \ echo "**** clean up ****" && \ - apt-get purge --auto-remove -y \ - build-essential \ - libx11-dev \ - libxkbfile-dev \ - libsecret-1-dev \ - pkg-config && \ - apt-get clean && \ rm -rf \ /config/* \ /tmp/* \ diff --git a/Jenkinsfile b/Jenkinsfile index 8ca9e36..daa2df1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -104,7 +104,7 @@ pipeline { steps{ script{ env.EXT_RELEASE = sh( - script: ''' curl -sX GET https://registry.yarnpkg.com/code-server | jq -r '."dist-tags".latest' | sed 's|^|v|' ''', + script: ''' curl -sX GET https://api.github.com/repos/coder/code-server/releases/latest | jq -r '.tag_name' | sed 's|^v||' ''', returnStdout: true).trim() env.RELEASE_LINK = 'custom_command' } diff --git a/README.md b/README.md index f2d5db4..d1f1fa5 100644 --- a/README.md +++ b/README.md @@ -266,6 +266,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64 ## Versions +* **20.02.22:** - Install using the official debs. * **29.12.21:** - Add `install-extension` as a helper for mods to install extensions. * **06.12.21:** - Add `DEFAULT_WORKSPACE` env var. * **29.11.21:** - Rebase to Ubuntu focal. diff --git a/jenkins-vars.yml b/jenkins-vars.yml index f05393f..5931893 100644 --- a/jenkins-vars.yml +++ b/jenkins-vars.yml @@ -3,7 +3,7 @@ # jenkins variables project_name: docker-code-server external_type: na -custom_version_command: "curl -sX GET https://registry.yarnpkg.com/code-server | jq -r '.\"dist-tags\".latest' | sed 's|^|v|'" +custom_version_command: "curl -sX GET https://api.github.com/repos/coder/code-server/releases/latest | jq -r '.tag_name' | sed 's|^v||'" release_type: stable release_tag: latest ls_branch: master diff --git a/readme-vars.yml b/readme-vars.yml index 7b86228..ffdbdc7 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -77,6 +77,7 @@ app_setup_block: | # changelog changelogs: + - { date: "20.02.22:", desc: "Install using the official debs." } - { date: "29.12.21:", desc: "Add `install-extension` as a helper for mods to install extensions." } - { date: "06.12.21:", desc: "Add `DEFAULT_WORKSPACE` env var." } - { date: "29.11.21:", desc: "Rebase to Ubuntu focal." } diff --git a/root/etc/services.d/code-server/run b/root/etc/services.d/code-server/run index 9afa866..e01307c 100644 --- a/root/etc/services.d/code-server/run +++ b/root/etc/services.d/code-server/run @@ -15,7 +15,7 @@ fi exec \ s6-setuidgid abc \ - /usr/local/bin/code-server \ + /usr/lib/code-server/bin/code-server \ --bind-addr 0.0.0.0:8443 \ --user-data-dir /config/data \ --extensions-dir /config/extensions \