-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
97 lines (82 loc) · 3 KB
/
docker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
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
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"
- 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@v5
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 }}:main
labels: ${{ steps.docker_meta.outputs.labels }}
file: scripts/docker/Dockerfile
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