-
Notifications
You must be signed in to change notification settings - Fork 10
89 lines (80 loc) · 3.51 KB
/
docker-build.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
name: Build Docker Images
on:
push:
# We only want to build on tags--if we include branches, we build twice.
# branches:
# - main
# - alpha
# - beta
tags:
- v*
jobs:
build:
name: Build Docker Images
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
# https://docs.docker.com/build/ci/github-actions/manage-tags-labels/
# https://github.com/docker/metadata-action#tags-input
# https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
photostructure/server
ghcr.io/photostructure/server
flavor: |
latest=false
# https://specs.opencontainers.org/image-spec/annotations/#pre-defined-annotation-keys
labels: |
org.opencontainers.image.title="PhotoStructure"
org.opencontainers.image.description="Your new home for all your photos and videos"
org.opencontainers.image.licenses="SEE LICENSE IN LICENSE.md"
org.opencontainers.image.url="https://photostructure.com/"
org.opencontainers.image.documentation="https://photostructure.com/server/photostructure-for-docker/"
tags: |
# always include the full semver (v1.2.3-alpha.1)
type=semver,pattern={{version}}
# minimal git SHA tag
type=sha
# tag every build as a :prealpha build
type=raw,value=prealpha
# unless this is a prealpha build, update the :alpha tag
type=raw,value=alpha,enable=${{ !contains(github.ref_name, 'prealpha') }}
# always update the beta tag unless it's an *alpha build, so people on :beta get the beta and stable builds:
type=raw,value=beta,enable=${{ !contains(github.ref_name, 'alpha') }}
# if it's not *alpha or beta, update :stable, :latest, and version tags.
type=raw,value=stable,enable=${{ !contains(github.ref_name, 'alpha') && !contains(github.ref_name, 'beta') }}
type=raw,value=latest,enable=${{ !contains(github.ref_name, 'alpha') && !contains(github.ref_name, 'beta') }}
type=semver,pattern=v{{major}},enable=${{ !contains(github.ref_name, 'alpha') && !contains(github.ref_name, 'beta') }}
type=semver,pattern=v{{major}}.{{minor}},enable=${{ !contains(github.ref_name, 'alpha') && !contains(github.ref_name, 'beta') }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Set up Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASS }}
- name: Log in to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}