fix: cross-compile Docker image for amd64 and add npm registry auth
- CI docker job: QEMU + buildx + --platform linux/amd64 (runners are arm64) - Dockerfile: REGISTRY_TOKEN build arg for @cameleer/design-system npm auth - CI build job: npm auth token for frontend build step - Registry cache for faster builds Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -30,8 +30,11 @@ jobs:
|
|||||||
- name: Build Frontend
|
- name: Build Frontend
|
||||||
run: |
|
run: |
|
||||||
cd ui
|
cd ui
|
||||||
|
echo "//gitea.siegeln.net/api/packages/cameleer/npm/:_authToken=${REGISTRY_TOKEN}" >> .npmrc
|
||||||
npm ci
|
npm ci
|
||||||
npm run build
|
npm run build
|
||||||
|
env:
|
||||||
|
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
|
|
||||||
- name: Build and Test (unit tests only)
|
- name: Build and Test (unit tests only)
|
||||||
run: >-
|
run: >-
|
||||||
@@ -76,15 +79,22 @@ jobs:
|
|||||||
echo "IMAGE_TAGS=branch-$SLUG" >> "$GITHUB_ENV"
|
echo "IMAGE_TAGS=branch-$SLUG" >> "$GITHUB_ENV"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
- name: Set up QEMU for cross-platform builds
|
||||||
|
run: docker run --rm --privileged gitea.siegeln.net/cameleer/binfmt:1 --install all
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
run: |
|
run: |
|
||||||
|
docker buildx create --use --name cibuilder
|
||||||
TAGS="-t gitea.siegeln.net/cameleer/cameleer-saas:${{ github.sha }}"
|
TAGS="-t gitea.siegeln.net/cameleer/cameleer-saas:${{ github.sha }}"
|
||||||
for TAG in $IMAGE_TAGS; do
|
for TAG in $IMAGE_TAGS; do
|
||||||
TAGS="$TAGS -t gitea.siegeln.net/cameleer/cameleer-saas:$TAG"
|
TAGS="$TAGS -t gitea.siegeln.net/cameleer/cameleer-saas:$TAG"
|
||||||
done
|
done
|
||||||
docker build $TAGS --provenance=false .
|
docker buildx build --platform linux/amd64 \
|
||||||
for TAG in $IMAGE_TAGS ${{ github.sha }}; do
|
--build-arg REGISTRY_TOKEN="$REGISTRY_TOKEN" \
|
||||||
docker push gitea.siegeln.net/cameleer/cameleer-saas:$TAG
|
$TAGS \
|
||||||
done
|
--cache-from type=registry,ref=gitea.siegeln.net/cameleer/cameleer-saas:buildcache \
|
||||||
|
--cache-to type=registry,ref=gitea.siegeln.net/cameleer/cameleer-saas:buildcache,mode=max \
|
||||||
|
--provenance=false \
|
||||||
|
--push .
|
||||||
env:
|
env:
|
||||||
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
FROM node:22-alpine AS frontend
|
FROM node:22-alpine AS frontend
|
||||||
|
ARG REGISTRY_TOKEN
|
||||||
WORKDIR /ui
|
WORKDIR /ui
|
||||||
COPY ui/package.json ui/package-lock.json ui/.npmrc ./
|
COPY ui/package.json ui/package-lock.json ui/.npmrc ./
|
||||||
RUN npm ci
|
RUN echo "//gitea.siegeln.net/api/packages/cameleer/npm/:_authToken=${REGISTRY_TOKEN}" >> .npmrc && npm ci
|
||||||
COPY ui/ .
|
COPY ui/ .
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user