From 9137da0f154cbad6946846cce08ee42ddd603a1a Mon Sep 17 00:00:00 2001 From: aptalca Date: Sun, 17 May 2020 20:40:11 -0400 Subject: [PATCH] Switch to multi-arch, install via npm --- Dockerfile | 34 +++++++++++----- Dockerfile.aarch64 | 61 +++++++++++++++++++++++++++++ Dockerfile.armhf | 61 +++++++++++++++++++++++++++++ Jenkinsfile | 2 +- README.md | 3 ++ jenkins-vars.yml | 2 +- readme-vars.yml | 3 ++ root/etc/services.d/code-server/run | 3 +- 8 files changed, 156 insertions(+), 13 deletions(-) create mode 100644 Dockerfile.aarch64 create mode 100644 Dockerfile.armhf diff --git a/Dockerfile b/Dockerfile index d705f59..90f2b1a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,28 +11,44 @@ LABEL maintainer="aptalca" ENV HOME="/config" RUN \ - echo "**** install dependencies ****" && \ + 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_12.x bionic main' \ + > /etc/apt/sources.list.d/nodesource.list && \ + echo "**** install build dependencies ****" && \ + apt-get update && \ + apt-get install -y \ + build-essential \ + libx11-dev \ + libxkbfile-dev \ + libsecret-1-dev \ + pkg-config && \ + echo "**** install runtime dependencies ****" && \ apt-get install -y \ git \ jq \ nano \ net-tools \ + nodejs \ sudo && \ echo "**** install code-server ****" && \ if [ -z ${CODE_RELEASE+x} ]; then \ CODE_RELEASE=$(curl -sX GET "https://api.github.com/repos/cdr/code-server/releases/latest" \ | awk '/tag_name/{print $4;exit}' FS='[""]'); \ fi && \ - CODE_URL=$(curl -sX GET "https://api.github.com/repos/cdr/code-server/releases/tags/${CODE_RELEASE}" \ - | jq -r '.assets[] | select(.browser_download_url | contains("linux-x86_64")) | .browser_download_url') && \ - mkdir -p /app/code-server && \ - curl -o \ - /tmp/code.tar.gz -L \ - "${CODE_URL}" && \ - tar xzf /tmp/code.tar.gz -C \ - /app/code-server --strip-components=1 && \ + CODE_VERSION=$(echo "$CODE_RELEASE" | awk '{print substr($1,2); }') && \ + npm install --unsafe-perm -g code-server@"$CODE_VERSION" && \ 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 \ /tmp/* \ /var/lib/apt/lists/* \ diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 new file mode 100644 index 0000000..89cd14f --- /dev/null +++ b/Dockerfile.aarch64 @@ -0,0 +1,61 @@ +FROM lsiobase/ubuntu:arm64v8-bionic + +# set version label +ARG BUILD_DATE +ARG VERSION +ARG CODE_RELEASE +LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" +LABEL maintainer="aptalca" + +# environment settings +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_12.x bionic main' \ + > /etc/apt/sources.list.d/nodesource.list && \ + echo "**** install build dependencies ****" && \ + apt-get update && \ + apt-get install -y \ + build-essential \ + libx11-dev \ + libxkbfile-dev \ + libsecret-1-dev \ + pkg-config && \ + echo "**** install runtime dependencies ****" && \ + apt-get install -y \ + git \ + jq \ + nano \ + net-tools \ + nodejs \ + sudo && \ + echo "**** install code-server ****" && \ + if [ -z ${CODE_RELEASE+x} ]; then \ + CODE_RELEASE=$(curl -sX GET "https://api.github.com/repos/cdr/code-server/releases/latest" \ + | awk '/tag_name/{print $4;exit}' FS='[""]'); \ + fi && \ + CODE_VERSION=$(echo "$CODE_RELEASE" | awk '{print substr($1,2); }') && \ + npm install --unsafe-perm -g code-server@"$CODE_VERSION" && \ + 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 \ + /tmp/* \ + /var/lib/apt/lists/* \ + /var/tmp/* + +# add local files +COPY /root / + +# ports and volumes +EXPOSE 8443 diff --git a/Dockerfile.armhf b/Dockerfile.armhf new file mode 100644 index 0000000..9ac9e89 --- /dev/null +++ b/Dockerfile.armhf @@ -0,0 +1,61 @@ +FROM lsiobase/ubuntu:arm32v7-bionic + +# set version label +ARG BUILD_DATE +ARG VERSION +ARG CODE_RELEASE +LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" +LABEL maintainer="aptalca" + +# environment settings +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_12.x bionic main' \ + > /etc/apt/sources.list.d/nodesource.list && \ + echo "**** install build dependencies ****" && \ + apt-get update && \ + apt-get install -y \ + build-essential \ + libx11-dev \ + libxkbfile-dev \ + libsecret-1-dev \ + pkg-config && \ + echo "**** install runtime dependencies ****" && \ + apt-get install -y \ + git \ + jq \ + nano \ + net-tools \ + nodejs \ + sudo && \ + echo "**** install code-server ****" && \ + if [ -z ${CODE_RELEASE+x} ]; then \ + CODE_RELEASE=$(curl -sX GET "https://api.github.com/repos/cdr/code-server/releases/latest" \ + | awk '/tag_name/{print $4;exit}' FS='[""]'); \ + fi && \ + CODE_VERSION=$(echo "$CODE_RELEASE" | awk '{print substr($1,2); }') && \ + npm install --unsafe-perm -g code-server@"$CODE_VERSION" && \ + 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 \ + /tmp/* \ + /var/lib/apt/lists/* \ + /var/tmp/* + +# add local files +COPY /root / + +# ports and volumes +EXPOSE 8443 diff --git a/Jenkinsfile b/Jenkinsfile index 4b10dd4..5ca6e14 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -27,7 +27,7 @@ pipeline { DEV_DOCKERHUB_IMAGE = 'lsiodev/code-server' PR_DOCKERHUB_IMAGE = 'lspipepr/code-server' DIST_IMAGE = 'ubuntu' - MULTIARCH='false' + MULTIARCH='true' CI='true' CI_WEB='true' CI_PORT='8443' diff --git a/README.md b/README.md index 614f006..dc111ab 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,8 @@ The architectures supported by this image are: | Architecture | Tag | | :----: | --- | | x86-64 | amd64-latest | +| arm64 | arm64v8-latest | +| armhf | arm32v7-latest | ## Version Tags @@ -234,6 +236,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64 ## Versions +* **18.05.20:** - Switch to multi-arch images, install via npm. * **29.04.20:** - Update start arguments. * **01.04.20:** - Structural changes required for v3. * **17.01.20:** - Fix artifact url retrieval from github. diff --git a/jenkins-vars.yml b/jenkins-vars.yml index db42eab..2e583cb 100644 --- a/jenkins-vars.yml +++ b/jenkins-vars.yml @@ -18,7 +18,7 @@ repo_vars: - DEV_DOCKERHUB_IMAGE = 'lsiodev/code-server' - PR_DOCKERHUB_IMAGE = 'lspipepr/code-server' - DIST_IMAGE = 'ubuntu' - - MULTIARCH='false' + - MULTIARCH='true' - CI='true' - CI_WEB='true' - CI_PORT='8443' diff --git a/readme-vars.yml b/readme-vars.yml index 33e8825..233eb5f 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -22,6 +22,8 @@ project_lsio_github_repo_url: "https://github.com/linuxserver/docker-{{ project_ # supported architectures available_architectures: - { arch: "{{ arch_x86_64 }}", tag: "amd64-latest"} + - { arch: "{{ arch_arm64 }}", tag: "arm64v8-latest"} + - { arch: "{{ arch_armhf }}", tag: "arm32v7-latest"} # development version development_versions: true @@ -65,6 +67,7 @@ app_setup_block: | # changelog changelogs: + - { date: "18.05.20:", desc: "Switch to multi-arch images, install via npm." } - { date: "29.04.20:", desc: "Update start arguments." } - { date: "01.04.20:", desc: "Structural changes required for v3." } - { date: "17.01.20:", desc: "Fix artifact url retrieval from github." } diff --git a/root/etc/services.d/code-server/run b/root/etc/services.d/code-server/run index 94896c6..89cadce 100644 --- a/root/etc/services.d/code-server/run +++ b/root/etc/services.d/code-server/run @@ -9,11 +9,10 @@ fi exec \ s6-setuidgid abc \ - /app/code-server/code-server \ + /usr/bin/code-server \ --bind-addr 0.0.0.0:8443 \ --user-data-dir /config/data \ --extensions-dir /config/extensions \ --disable-telemetry \ - --disable-updates \ --auth "${AUTH}" \ /config/workspace