Fix package.json, Dockerfile, add CI validation to prevent recurrence
Build and push images / validate (push) Successful in 2s
Build and push images / build-backend (push) Successful in 5s
Build and push images / build-worker (push) Successful in 5s
Build and push images / build-frontend (push) Successful in 21s

This commit is contained in:
2026-06-06 18:27:29 +01:00
parent 070267eee5
commit 24f8417982
3 changed files with 37 additions and 11 deletions
+33 -7
View File
@@ -6,15 +6,41 @@ on:
workflow_dispatch:
jobs:
build-backend:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log in to registry
- name: Validate package.json
run: |
echo "${{ secrets.PACKAGE_TOKEN }}" | docker login gitea.jarrett.eu -u ${{ gitea.actor }} --password-stdin
# Fail if package.json is invalid JSON
python3 -c "import json, sys; json.load(open('frontend/package.json'))" || \
{ echo "ERROR: frontend/package.json is invalid JSON"; exit 1; }
# Fail if non-existent packages are present
if grep -q "@polyline-codec" frontend/package.json; then
echo "ERROR: @polyline-codec/core does not exist on npm - remove it"
exit 1
fi
# Fail if npm ci is still in Dockerfile (requires lockfile we don't have)
if grep -q "npm ci" frontend/Dockerfile; then
echo "ERROR: frontend/Dockerfile uses 'npm ci' but no package-lock.json exists - change to 'npm install'"
exit 1
fi
echo "Validation passed"
build-backend:
runs-on: ubuntu-latest
needs: validate
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log in to registry
run: echo "${{ secrets.PACKAGE_TOKEN }}" | docker login gitea.jarrett.eu -u ${{ gitea.actor }} --password-stdin
- name: Build and push backend
uses: docker/build-push-action@v5
@@ -28,13 +54,13 @@ jobs:
build-worker:
runs-on: ubuntu-latest
needs: validate
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log in to registry
run: |
echo "${{ secrets.PACKAGE_TOKEN }}" | docker login gitea.jarrett.eu -u ${{ gitea.actor }} --password-stdin
run: echo "${{ secrets.PACKAGE_TOKEN }}" | docker login gitea.jarrett.eu -u ${{ gitea.actor }} --password-stdin
- name: Build and push worker
uses: docker/build-push-action@v5
@@ -48,13 +74,13 @@ jobs:
build-frontend:
runs-on: ubuntu-latest
needs: validate
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log in to registry
run: |
echo "${{ secrets.PACKAGE_TOKEN }}" | docker login gitea.jarrett.eu -u ${{ gitea.actor }} --password-stdin
run: echo "${{ secrets.PACKAGE_TOKEN }}" | docker login gitea.jarrett.eu -u ${{ gitea.actor }} --password-stdin
- name: Build and push frontend
uses: docker/build-push-action@v5
+1 -1
View File
@@ -1,7 +1,7 @@
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
COPY package.json ./
RUN npm install
COPY . .