mirror of
https://github.com/bybrooklyn/alchemist.git
synced 2026-04-18 09:53:33 -04:00
93 lines
2.6 KiB
YAML
93 lines
2.6 KiB
YAML
name: Docker
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- 'VERSION'
|
|
- 'Dockerfile'
|
|
- '.dockerignore'
|
|
- 'src/**'
|
|
- 'web/**'
|
|
- 'Cargo.toml'
|
|
- 'Cargo.lock'
|
|
- 'migrations/**'
|
|
- 'build.rs'
|
|
- '.github/workflows/docker.yml'
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: docker-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
env:
|
|
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
|
|
|
|
jobs:
|
|
docker:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 90
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 1
|
|
|
|
- name: Lowercase image name
|
|
id: image
|
|
run: |
|
|
echo "name=$(echo 'ghcr.io/bybrooklyn/alchemist' \
|
|
| tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Set up QEMU
|
|
if: github.event_name == 'workflow_dispatch'
|
|
uses: docker/setup-qemu-action@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v4
|
|
|
|
- name: Log in to GHCR
|
|
if: github.event_name != 'pull_request'
|
|
uses: docker/login-action@v4
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build (PR preview — no push)
|
|
if: github.event_name == 'pull_request'
|
|
uses: docker/build-push-action@v7
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64
|
|
push: false
|
|
cache-from: |
|
|
type=gha,scope=docker-amd64
|
|
type=registry,ref=ghcr.io/bybrooklyn/alchemist:buildcache-amd64
|
|
cache-to: |
|
|
type=gha,scope=docker-amd64,mode=max
|
|
provenance: false
|
|
|
|
- name: Build and push (manual dispatch)
|
|
if: github.event_name == 'workflow_dispatch'
|
|
uses: docker/build-push-action@v7
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
tags: ${{ steps.image.outputs.name }}:dev
|
|
cache-from: |
|
|
type=gha,scope=docker-amd64
|
|
type=gha,scope=docker-arm64
|
|
type=registry,ref=ghcr.io/bybrooklyn/alchemist:buildcache-amd64
|
|
type=registry,ref=ghcr.io/bybrooklyn/alchemist:buildcache-arm64
|
|
cache-to: |
|
|
type=gha,scope=docker-amd64,mode=max
|
|
type=gha,scope=docker-arm64,mode=max
|
|
type=registry,ref=ghcr.io/bybrooklyn/alchemist:buildcache-amd64,mode=max,image-manifest=true,oci-mediatypes=true
|
|
type=registry,ref=ghcr.io/bybrooklyn/alchemist:buildcache-arm64,mode=max,image-manifest=true,oci-mediatypes=true
|
|
provenance: false
|