Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,24 +60,18 @@ jobs:
include:
- name: Docker linux/amd64
DOCKER_PLATFORM: linux/amd64
CACHE_SCOPE: docker-amd64
RUNNER_TYPE: ubuntu-latest
- name: Docker linux/arm64/v8
DOCKER_PLATFORM: linux/arm64/v8
CACHE_SCOPE: docker-arm64
RUNNER_TYPE: ubuntu-latest
# - name: Docker linux/arm64/v8
# DOCKER_PLATFORM: linux/arm64/v8
# # Replace this with a native arm linux runner when available, presumably by EOY 2024, see:
# # https://github.com/orgs/community/discussions/19197#discussioncomment-10550689
# # The conditional setup of QEMU may need to be adapted to not run on native arm,
# # which will speed up the build process for arm64/v8 since no emulation will be needed.
# RUNNER_TYPE: ubuntu-latest
fail-fast: false
name: ${{ matrix.name }}
timeout-minutes: 45
runs-on: ${{ matrix.RUNNER_TYPE }}
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
# Only set up QEMU if not running on native arm
if: ${{ matrix.DOCKER_PLATFORM != 'linux/amd64' && matrix.RUNNER_TYPE == 'ubuntu-latest' }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
Expand All @@ -86,8 +80,8 @@ jobs:
uses: docker/build-push-action@v3
with:
platforms: ${{ matrix.DOCKER_PLATFORM }}
cache-from: type=gha
cache-to: type=gha,mode=max
cache-from: type=gha,scope=${{ matrix.CACHE_SCOPE }}
cache-to: type=gha,mode=max,scope=${{ matrix.CACHE_SCOPE }}
check-lock-file-version:
name: NPM Lock File Version
timeout-minutes: 5
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/release-automated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ jobs:
uses: actions/checkout@v2
with:
ref: ${{ needs.release.outputs.current_tag }}
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/release-manual-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ jobs:
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.ref }}
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
Expand Down
32 changes: 25 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,50 @@
############################################################
# Build stage
############################################################
FROM node:20.19.0-alpine3.20 AS build
# Runs on the platform of the build machine, also when building the image for
# another platform, so that no code runs under emulation; Node.js running under
# QEMU emulation can crash with an illegal instruction. Builders that don't set
# BUILDPLATFORM, like the legacy Docker builder, run it on their own platform.
FROM --platform=${BUILDPLATFORM:-linux} node:20.19.0-alpine3.20 AS build

RUN apk --no-cache add git
WORKDIR /src

# Copy package.json first to benefit from layer caching
COPY package*.json ./

# Install without scripts otherwise webpack will fail
RUN npm ci --omit=dev --ignore-scripts
# Architecture of the image to build, set by BuildKit; builders that don't set
# it build the image for their own platform
ARG TARGETARCH

# Install production dependencies for the image platform without scripts
# otherwise webpack will fail
RUN arch="${TARGETARCH:-$(uname -m)}" \
&& case "$arch" in \
amd64|x86_64) cpu=x64 ;; \
arm64|aarch64) cpu=arm64 ;; \
arm|armv6l|armv7l) cpu=arm ;; \
ppc64le) cpu=ppc64 ;; \
s390x) cpu=s390x ;; \
*) echo "Unsupported target architecture: '$arch'" >&2; exit 1 ;; \
esac \
&& npm ci --omit=dev --ignore-scripts --os=linux --cpu="$cpu" --libc=musl

# Copy production node_modules aside for later
RUN cp -R node_modules prod_node_modules

# Copy src to have webpack config files ready for install
COPY . /src

# Install remaining dev dependencies
# Install remaining dev dependencies; this also runs the prepare script, which
# builds the bundles of the image
RUN npm ci

# Run all webpack build steps
RUN npm run prepare && npm run build

############################################################
# Release stage
############################################################
# Must not contain RUN instructions, because building the image for another
# platform than the one of the build machine would then require emulation.
FROM node:20.19.0-alpine3.20 AS release
WORKDIR /src

Expand Down
Loading