f504e9e1a2
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
111 lines
3.4 KiB
YAML
111 lines
3.4 KiB
YAML
name: Docker
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
types: [opened, synchronize, reopened]
|
|
release:
|
|
types: [published]
|
|
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: Docker ${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
package-name: monica-next
|
|
registry: ghcr.io
|
|
|
|
jobs:
|
|
docker-run:
|
|
runs-on: ubuntu-latest
|
|
name: Docker build developpment
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
flavor:
|
|
- name: apache
|
|
file: scripts/docker/Dockerfile
|
|
tag: main
|
|
suffix: ''
|
|
- name: fpm
|
|
file: scripts/docker/Dockerfile-fpm
|
|
tag: main-fpm
|
|
suffix: -fpm
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v5
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Docker meta
|
|
id: docker_meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ env.registry }}/${{ github.repository_owner }}/${{ env.package-name }}
|
|
tags: |
|
|
type=schedule
|
|
type=ref,event=branch
|
|
type=ref,event=tag
|
|
type=ref,event=pr
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
type=semver,pattern={{major}}
|
|
labels: |
|
|
org.opencontainers.image.description="This is MonicaHQ, your personal memory! MonicaHQ is like a CRM but for the friends, family, and acquaintances around you."
|
|
org.opencontainers.image.title="MonicaHQ, the Personal Relationship Manager"
|
|
org.opencontainers.image.vendor="Monica"
|
|
flavor: |
|
|
latest=${{ matrix.flavor.tag == 'main' && 'auto' || 'false' }}
|
|
suffix=${{ matrix.flavor.suffix }}
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to GitHub container registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.registry }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
# 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@v6
|
|
with:
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
tags: ${{ steps.docker_meta.outputs.tags }}
|
|
cache-from: type=registry,ref=${{ env.registry }}/${{ github.repository_owner }}/${{ env.package-name }}:${{ matrix.flavor.tag }}
|
|
labels: ${{ steps.docker_meta.outputs.labels }}
|
|
file: ${{ matrix.flavor.file }}
|
|
context: .
|
|
platforms: ${{ (github.event_name != 'pull_request') && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
|
|
outputs: type=image,name=target,annotation-index.org.opencontainers.image.description=This is MonicaHQ your personal memory! MonicaHQ is like a CRM but for the friends family and acquaintances around you.
|
|
|
|
- name: Image digest
|
|
run: echo ${{ steps.docker_build.outputs.digest }}
|
|
|
|
- name: Prune images
|
|
uses: vlaurin/action-ghcr-prune@v0.6.0
|
|
if: github.event_name != 'pull_request'
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
organization: ${{ github.repository_owner }}
|
|
container: ${{ env.package-name }}
|
|
keep-younger-than: 15
|
|
prune-untagged: true
|