Skip to content

Build Docker Image

Build Docker Image #25

Workflow file for this run

name: Build Docker Image
on:
workflow_dispatch:
workflow_run:
workflows: ['CI']
types:
- completed
env:
TAGS: ghcr.io/versatiles-org/versatiles-choro:latest
jobs:
build:
if: ${{ ( github.event_name != 'workflow_run' && github.ref == 'refs/heads/main' ) || ( github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'main' ) }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: '24'
cache: 'npm'
- run: npm ci
- run: npm run check
- run: npm run build
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
install: true
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker image for testing
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
pull: true
load: true
tags: ${{ env.TAGS }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Test Docker image
run: ./docker/test.sh ${{ env.TAGS }}
- name: Build & Push multi-arch Docker image
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
platforms: linux/amd64,linux/arm64
pull: true
push: true
tags: ${{ env.TAGS }}
cache-from: type=gha
cache-to: type=gha,mode=max