chore(ci): optimize multi-platform Docker publish workflow

This commit is contained in:
germondai
2026-06-26 19:12:10 +02:00
parent 65accc03ae
commit 64a2eacad1
2 changed files with 14 additions and 5 deletions
+6 -2
View File
@@ -3,13 +3,17 @@ name: Publish
on:
push:
branches: [main]
tags: ['v*']
tags: ["v*"]
env:
IMAGE: ghcr.io/${{ github.repository_owner }}/trawl
jobs:
publish:
strategy:
matrix:
platform: [linux/amd64, linux/arm64]
runs-on: ubuntu-latest
permissions:
contents: read
@@ -39,7 +43,7 @@ jobs:
with:
context: .
file: apps/api/Dockerfile
platforms: linux/amd64,linux/arm64
platforms: ${{ matrix.platform }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
+8 -3
View File
@@ -18,13 +18,18 @@ COPY apps/docs/package.json ./apps/docs/
# --production skips devDependencies (vitepress + algolia from docs, typescript, @types)
RUN bun install --frozen-lockfile --production
# ── Stage 2: fetch the Camoufox Firefox binary for the target platform ─────────
# ── Stage 2: fetch the Camoufox Firefox binary ─────────
FROM oven/bun:1.3.14 AS camoufox
ENV CAMOUFOX_INSTALL_DIR=/opt/camoufox
RUN apt-get update && apt-get install -y --no-install-recommends \
nodejs npm python3 make g++ \
&& rm -rf /var/lib/apt/lists/*
nodejs npm python3 make g++ && rm -rf /var/lib/apt/lists/*
# Use BuildKit cache for the download
RUN --mount=type=secret,id=GITHUB_TOKEN,env=GITHUB_TOKEN \
--mount=type=cache,target=/root/.cache/camoufox,sharing=locked \
bun x camoufox-js fetch \
&& rm -rf /opt/camoufox/fonts/macos /opt/camoufox/fonts/windows
# Secret mount keeps GITHUB_TOKEN out of image layers.
# Token prevents GitHub API rate-limits that cause the binary download to stall.