77 lines
1.9 KiB
YAML
77 lines
1.9 KiB
YAML
name: Docker
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- chandler
|
|
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: Docker ${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
package-name: monica-next
|
|
|
|
jobs:
|
|
docker-run:
|
|
runs-on: ubuntu-latest
|
|
name: Docker build developpment
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Docker meta
|
|
id: docker_meta
|
|
uses: crazy-max/ghaction-docker-meta@v5
|
|
with:
|
|
images: ghcr.io/${{ github.repository_owner }}/${{ env.package-name }}
|
|
tag-sha: true
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to GitHub container registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ secrets.CR_USER }}
|
|
password: ${{ secrets.CR_PAT }}
|
|
|
|
# Configure
|
|
- name: Configure variables
|
|
run: scripts/docker/build.sh --skip-build $GITHUB_SHA
|
|
|
|
# Build docker
|
|
- name: Docker build
|
|
id: docker_build
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
push: true
|
|
tags: ${{ steps.docker_meta.outputs.tags }}
|
|
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/${{ env.package-name }}:main
|
|
labels: ${{ steps.docker_meta.outputs.labels }}
|
|
file: scripts/docker/Dockerfile
|
|
context: .
|
|
platforms: linux/amd64,linux/arm64
|
|
|
|
- name: Image digest
|
|
run: echo ${{ steps.docker_build.outputs.digest }}
|
|
|
|
- name: Prune images
|
|
uses: vlaurin/action-ghcr-prune@v0.5.0
|
|
with:
|
|
token: ${{ secrets.CR_PAT }}
|
|
organization: ${{ github.repository_owner }}
|
|
container: ${{ env.package-name }}
|
|
keep-younger-than: 15
|
|
prune-untagged: true
|