From b087315336e30a0e9088c88d2570851f7a14a075 Mon Sep 17 00:00:00 2001 From: aptalca Date: Sun, 20 Feb 2022 21:04:50 -0500 Subject: [PATCH] use official tarballs and patch arm builds --- Dockerfile | 37 +++++++++++++++++++++++++--- Dockerfile.aarch64 | 37 +++++++++++++++++++++++++--- Dockerfile.armhf | 35 ++++++++++++++++++++++---- README.md | 2 +- readme-vars.yml | 2 +- root/etc/services.d/code-server/run | 2 +- root/usr/local/bin/install-extension | 2 +- 7 files changed, 100 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2aa9e59..38d8c51 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,21 +11,50 @@ LABEL maintainer="aptalca" ENV HOME="/config" RUN \ + echo "**** install node repo ****" && \ + 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 && \ + echo "**** install build dependencies ****" && \ + apt-get update && \ + apt-get install -y \ + build-essential \ + nodejs && \ + echo "**** install runtime dependencies ****" && \ + apt-get install -y \ + git \ + jq \ + libatomic1 \ + nano \ + net-tools \ + sudo && \ echo "**** install code-server ****" && \ if [ -z ${CODE_RELEASE+x} ]; then \ 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 && \ + mkdir -p /app/code-server && \ 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 && \ + /tmp/code-server.tar.gz -L \ + "https://github.com/coder/code-server/releases/download/v${CODE_RELEASE}/code-server-${CODE_RELEASE}-linux-armv7l.tar.gz" && \ + tar xf /tmp/code-server.tar.gz -C \ + /app/code-server --strip-components=1 && \ + echo "**** patch 4.0.2 ****" && \ + if [ "${CODE_RELEASE}" = "4.0.2" ] && [ "$(uname -m)" != "x86_64" ]; then \ + cd /app/code-server && \ + npm i --production @node-rs/argon2; \ + fi && \ echo "**** clean up ****" && \ + apt-get purge --auto-remove -y \ + build-essential \ + nodejs && \ + apt-get clean && \ rm -rf \ /config/* \ /tmp/* \ /var/lib/apt/lists/* \ - /var/tmp/* + /var/tmp/* \ + /etc/apt/sources.list.d/nodesource.list # add local files COPY /root / diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 38d1fde..e739ca3 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -11,21 +11,50 @@ LABEL maintainer="aptalca" ENV HOME="/config" RUN \ + echo "**** install node repo ****" && \ + 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 && \ + echo "**** install build dependencies ****" && \ + apt-get update && \ + apt-get install -y \ + build-essential \ + nodejs && \ + echo "**** install runtime dependencies ****" && \ + apt-get install -y \ + git \ + jq \ + libatomic1 \ + nano \ + net-tools \ + sudo && \ echo "**** install code-server ****" && \ if [ -z ${CODE_RELEASE+x} ]; then \ 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 && \ + mkdir -p /app/code-server && \ 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 && \ + /tmp/code-server.tar.gz -L \ + "https://github.com/coder/code-server/releases/download/v${CODE_RELEASE}/code-server-${CODE_RELEASE}-linux-armv7l.tar.gz" && \ + tar xf /tmp/code-server.tar.gz -C \ + /app/code-server --strip-components=1 && \ + echo "**** patch 4.0.2 ****" && \ + if [ "${CODE_RELEASE}" = "4.0.2" ] && [ "$(uname -m)" != "x86_64" ]; then \ + cd /app/code-server && \ + npm i --production @node-rs/argon2; \ + fi && \ echo "**** clean up ****" && \ + apt-get purge --auto-remove -y \ + build-essential \ + nodejs && \ + apt-get clean && \ rm -rf \ /config/* \ /tmp/* \ /var/lib/apt/lists/* \ - /var/tmp/* + /var/tmp/* \ + /etc/apt/sources.list.d/nodesource.list # add local files COPY /root / diff --git a/Dockerfile.armhf b/Dockerfile.armhf index 6b73693..5b5063f 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -11,25 +11,50 @@ LABEL maintainer="aptalca" ENV HOME="/config" RUN \ + echo "**** install node repo ****" && \ + 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 && \ + echo "**** install build dependencies ****" && \ apt-get update && \ apt-get install -y \ - libatomic1 && \ + build-essential \ + nodejs && \ + echo "**** install runtime dependencies ****" && \ + apt-get install -y \ + git \ + jq \ + libatomic1 \ + nano \ + net-tools \ + sudo && \ echo "**** install code-server ****" && \ if [ -z ${CODE_RELEASE+x} ]; then \ 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 && \ + mkdir -p /app/code-server && \ 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 && \ + /tmp/code-server.tar.gz -L \ + "https://github.com/coder/code-server/releases/download/v${CODE_RELEASE}/code-server-${CODE_RELEASE}-linux-armv7l.tar.gz" && \ + tar xf /tmp/code-server.tar.gz -C \ + /app/code-server --strip-components=1 && \ + echo "**** patch 4.0.2 ****" && \ + if [ "${CODE_RELEASE}" = "4.0.2" ] && [ "$(uname -m)" != "x86_64" ]; then \ + cd /app/code-server && \ + npm i --production @node-rs/argon2; \ + fi && \ echo "**** clean up ****" && \ + apt-get purge --auto-remove -y \ + build-essential \ + nodejs && \ apt-get clean && \ rm -rf \ /config/* \ /tmp/* \ /var/lib/apt/lists/* \ - /var/tmp/* + /var/tmp/* \ + /etc/apt/sources.list.d/nodesource.list # add local files COPY /root / diff --git a/README.md b/README.md index d1f1fa5..de335b8 100644 --- a/README.md +++ b/README.md @@ -266,7 +266,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64 ## Versions -* **20.02.22:** - Install using the official debs. +* **20.02.22:** - Install using the official tarballs. * **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/readme-vars.yml b/readme-vars.yml index ffdbdc7..76c8bb4 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -77,7 +77,7 @@ app_setup_block: | # changelog changelogs: - - { date: "20.02.22:", desc: "Install using the official debs." } + - { date: "20.02.22:", desc: "Install using the official tarballs." } - { 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 e01307c..689e176 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/lib/code-server/bin/code-server \ + /app/code-server/bin/code-server \ --bind-addr 0.0.0.0:8443 \ --user-data-dir /config/data \ --extensions-dir /config/extensions \ diff --git a/root/usr/local/bin/install-extension b/root/usr/local/bin/install-extension index 16342b9..79c922a 100755 --- a/root/usr/local/bin/install-extension +++ b/root/usr/local/bin/install-extension @@ -1,7 +1,7 @@ #!/usr/bin/with-contenv bash # shellcheck shell=bash -_install=(/usr/local/bin/code-server "--extensions-dir" "/config/extensions" "--install-extension") +_install=(/app/code-server/bin/code-server "--extensions-dir" "/config/extensions" "--install-extension") if [ "$(whoami)" == "abc" ]; then "${_install[@]}" "$@"