fix: fix responsive version (#7424) #1945
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 | |
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@v4 | |
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/[email protected] | |
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 |