-
-
Notifications
You must be signed in to change notification settings - Fork 0
117 lines (104 loc) · 3.27 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# Copyright © Michal Čihař <[email protected]>
#
# SPDX-License-Identifier: MIT
name: Docker Image CI
on:
schedule:
- cron: 0 10 * * *
push:
branches-ignore:
- renovate/**
tags:
- v*
pull_request:
jobs:
docker:
permissions:
packages: write
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Pin base for dev
run: sed -i "s@FROM weblate/base:latest@FROM weblate/base:sha-${{ github.sha }}@" dev/Dockerfile
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta (base)
id: base
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
weblate/base
ghcr.io/weblateorg/base
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=edge,branch=main
type=sha,format=long
- name: Docker meta (dev)
id: dev
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
weblate/dev
ghcr.io/weblateorg/dev
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=edge,branch=main
type=sha,format=long
- name: Build and push (base)
uses: docker/build-push-action@v6
with:
context: base
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.base.outputs.tags }}
labels: ${{ steps.base.outputs.labels }}
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
# This build should be cached, but needed to load
# image for dev container as load does not work with multiple
# platforms
- name: Build and load (base)
uses: docker/build-push-action@v6
with:
context: base
labels: ${{ steps.base.outputs.labels }}
load: true
- name: Build and push (dev)
uses: docker/build-push-action@v6
with:
context: dev
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.dev.outputs.tags }}
labels: ${{ steps.dev.outputs.labels }}
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max