Skip to content

Add Docker image release pipeline #1

Add Docker image release pipeline

Add Docker image release pipeline #1

Workflow file for this run

# Build verification for pull requests and the default branch.
#
# Both published architectures are built here, so an architecture-specific failure surfaces on
# the pull request rather than during a release. Pushes to the default branch also export the
# BuildKit cache that docker-release.yml consumes.
name: CI
on:
pull_request:
push:
branches: [main]
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
env:
IMAGE_NAME: keeper/gchat-app
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install dependencies from the lockfile
run: npm ci --omit=dev
- name: Offline end-to-end flow
run: npm run test:local
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build both published architectures
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: false
provenance: false
sbom: false
cache-from: type=gha,scope=gchat-app
cache-to: ${{ github.ref == 'refs/heads/main' && 'type=gha,mode=max,scope=gchat-app' || '' }}
- name: Load the amd64 image for a smoke test
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
load: true
push: false
provenance: false
sbom: false
tags: ${{ env.IMAGE_NAME }}:ci
cache-from: type=gha,scope=gchat-app
# The app exposes no HTTP surface, so the container-level assertion is that it starts
# and exits with a clear error when configuration is missing.
- name: Smoke test
run: |
set -euo pipefail
docker run --rm --entrypoint node "${IMAGE_NAME}:ci" \
-e 'console.log(process.arch, process.version)'
out="$(docker run --rm "${IMAGE_NAME}:ci" 2>&1 || true)"
if ! grep -q 'Missing configuration' <<<"$out"; then
echo "::error::Container did not exit with the expected configuration error"
printf '%s\n' "$out"
exit 1
fi
echo "Smoke test OK"