-
Notifications
You must be signed in to change notification settings - Fork 11
71 lines (60 loc) · 1.94 KB
/
Copy pathdocker-image.yml
File metadata and controls
71 lines (60 loc) · 1.94 KB
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
name: Build and Push Docker Image
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
REGISTRY: ghcr.io
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Read Nextcloud version
id: nextcloud_version
run: |
version=$(grep -m1 '^NEXTCLOUD_VERSION=' .env.example | cut -d= -f2-)
if [ -z "$version" ]; then
echo "NEXTCLOUD_VERSION is missing from .env.example" >&2
exit 1
fi
echo "value=$version" >> "$GITHUB_OUTPUT"
- name: Normalize repository name
id: repo_name
run: echo "value=${GITHUB_REPOSITORY,,}" >> "$GITHUB_OUTPUT"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Container Registry
if: github.event_name == 'push'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build app image
uses: docker/build-push-action@v6
with:
context: .docker/app
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name == 'push' }}
build-args: |
NEXTCLOUD_VERSION=${{ steps.nextcloud_version.outputs.value }}
tags: ${{ env.REGISTRY }}/${{ steps.repo_name.outputs.value }}-app:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build web image
uses: docker/build-push-action@v6
with:
context: .docker/web
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name == 'push' }}
tags: ${{ env.REGISTRY }}/${{ steps.repo_name.outputs.value }}-web:latest
cache-from: type=gha
cache-to: type=gha,mode=max