From dc338bc9df5899a6d1937d0333a28ec80a137d67 Mon Sep 17 00:00:00 2001 From: Thijs Putman Date: Wed, 12 May 2021 17:27:19 +0200 Subject: [PATCH] Provide an actual multi-arch Docker build Removed all hard-coded references to aarch64. The local aarch64 build still works, let's see what happens with the GitHub workflow... --- .dockerignore | 2 ++ Dockerfile | 21 ++++++++++++++------- TODO | 4 ---- 3 files changed, 16 insertions(+), 11 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..c8dbc49 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +.git/ +node_modules/ diff --git a/Dockerfile b/Dockerfile index eabc42e..7f3a1ef 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM arm64v8/node:12-alpine3.12 AS npm-ci +FROM node:12-alpine3.12 AS npm-ci SHELL ["/bin/ash", "-euo", "pipefail", "-c"] @@ -9,18 +9,25 @@ COPY package*.json *.js LICENSE ./ RUN apk add --no-cache python3~=3.8 make~=4.3 g++~=9.3 && \ npm ci --production -FROM arm64v8/node:12-alpine3.12 +FROM node:12-alpine3.12 SHELL ["/bin/ash", "-euo", "pipefail", "-c"] RUN apk add --no-cache --virtual /tmp/.gpg gnupg~=2.2 && \ + # Set correct architecture for s6-overlay + case $(arch) in \ + aarch64) arch=aarch64 ;; \ + armv7l) arch=armhf ;; \ + x86_64) arch=amd64 ;; \ + *) echo "Invalid architecture '$(arch)'" && exit 1 ;; \ + esac && \ # Download just-containers s6-overlay installer and its signature - wget -O /tmp/s6-installer \ - https://github.com/just-containers/s6-overlay/releases/download/v2.1.0.2/s6-overlay-aarch64-installer && \ - wget -O /tmp/s6-installer.sig \ - https://github.com/just-containers/s6-overlay/releases/download/v2.1.0.2/s6-overlay-aarch64-installer.sig && \ + wget -nv -O /tmp/s6-installer \ + "https://github.com/just-containers/s6-overlay/releases/download/v2.1.0.2/s6-overlay-$arch-installer" && \ + wget -nv -O /tmp/s6-installer.sig \ + "https://github.com/just-containers/s6-overlay/releases/download/v2.1.0.2/s6-overlay-$arch-installer.sig" && \ # Import just-containers' public key; use gpgv to validate installer - wget -O - https://keybase.io/justcontainers/pgp_keys.asc?fingerprint=db301ba3f6f807e0d0e6ccb86101b2783b2fd161 | \ + wget -nv -O - https://keybase.io/justcontainers/pgp_keys.asc?fingerprint=db301ba3f6f807e0d0e6ccb86101b2783b2fd161 | \ gpg --no-default-keyring --keyring /tmp/s6-installer.gpg --import && \ gpgv --keyring /tmp/s6-installer.gpg /tmp/s6-installer.sig /tmp/s6-installer && \ # Execute the installer diff --git a/TODO b/TODO index 08557ee..f0248ae 100644 --- a/TODO +++ b/TODO @@ -12,7 +12,3 @@ (regardless of the script's exit code) - Build some retry logic into the s6-overlay scripts? Or find a way to "escalate" the problem out of the container? -- [ ] The multi-arch Dockers don't actually work... 😳 - - The `📄 Dockerfile` is hardcoded to using `arm64v8/node:12-alpine3.12` as - its base image _and_ I'm pulling in the `s6-overlay-aarch64-installer` - regardless of the target architecture... 🤐