ci: fix docker labels again (#6979) #1287
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
concurrency: | |
group: Docker ${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
package-name: monica-next | |
description: This is MonicaHQ, your personal memory! MonicaHQ is like a CRM but for the friends, family, and acquaintances around you. | |
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: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/${{ github.repository_owner }}/${{ env.package-name }} | |
tags: | | |
type=sha | |
labels: | | |
org.opencontainers.image.description="${{ env.description }}" | |
org.opencontainers.image.title="MonicaHQ, the Personal Relationship Manager" | |
org.opencontainers.image.vendor="Monica" | |
- 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 | |
outputs: type=image,name=target,annotation-index.org.opencontainers.image.description="${{ env.description }}" | |
- name: Image digest | |
run: echo ${{ steps.docker_build.outputs.digest }} | |
- name: Prune images | |
uses: vlaurin/[email protected] | |
with: | |
token: ${{ secrets.CR_PAT }} | |
organization: ${{ github.repository_owner }} | |
container: ${{ env.package-name }} | |
keep-younger-than: 15 | |
prune-untagged: true |