Skip to content

Commit

Permalink
Provide an actual multi-arch Docker build
Browse files Browse the repository at this point in the history
Removed all hard-coded references to aarch64. The local aarch64 build
still works, let's see what happens with the GitHub workflow...
  • Loading branch information
thijsputman committed May 12, 2021
1 parent ec56c1a commit dc338bc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.git/
node_modules/
21 changes: 14 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]

Expand All @@ -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
Expand Down
4 changes: 0 additions & 4 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -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... 🤐

0 comments on commit dc338bc

Please sign in to comment.