-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (89 loc) · 3.06 KB
/
main.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
name: main
on:
push:
branches: [ master, main ]
pull_request:
branches: [ master, main ]
jobs:
docker:
strategy:
fail-fast: false
matrix:
experimental: [false]
arch:
- 'x64'
python:
- '3.12'
alpine:
- '3.20'
os:
- 'ubuntu-latest'
runs-on: ${{ matrix.os }}
steps:
-
name: Checkout
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: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
id: image_env
run: |
. ./env.sh '${{ matrix.alpine }}' '${{ matrix.python }}' '${{ github.repository_owner }}'
docker pull "${SOURCE_IMAGE}"
echo ALPINE_VERSION="${ALPINE_VERSION}" >> "$GITHUB_OUTPUT"
echo PYTHON_VERSION="${PYTHON_VERSION}" >> "$GITHUB_OUTPUT"
echo SOURCE_IMAGE="${SOURCE_IMAGE}" >> "$GITHUB_OUTPUT"
echo REPO_TAG="${REPO_TAG}" >> "$GITHUB_OUTPUT"
echo BASE_IMAGE_DIGEST="$(digest_of "$SOURCE_IMAGE")" >> "$GITHUB_OUTPUT"
-
name: Build deps
uses: docker/build-push-action@v6
with:
push: false
pull: false
load: true
context: "."
file: Dockerfile.alpine
target: builder
cache-from:
- type=registry,ref=${{ steps.image_env.outputs.REPO_TAG }}-buildroot
cache-to:
- type=registry,ref=${{ steps.image_env.outputs.REPO_TAG }}-buildroot,mode=max
build-args: |
ALPINE_VERSION=${{ steps.image_env.outputs.ALPINE_VERSION }}
BASE_IMAGE_DIGEST=${{ steps.image_env.outputs.BASE_IMAGE_DIGEST }}
PYTHON_VERSION=${{ steps.image_env.outputs.PYTHON_VERSION }}
SOURCE_IMAGE=${{ steps.image_env.outputs.SOURCE_IMAGE }}
BUILD_ROOT=/d
tags: "${{ steps.image_env.outputs.REPO_TAG }}-buildroot"
-
name: Build
uses: docker/build-push-action@v6
with:
push: false
pull: false
load: true
context: "."
file: Dockerfile.alpine
cache-from:
- type=registry,ref=${{ steps.image_env.outputs.REPO_TAG }}
- type=registry,ref=${{ steps.image_env.outputs.REPO_TAG }}-buildroot
- type=registry,ref=${{ steps.image_env.outputs.SOURCE_IMAGE }}
build-args: |
ALPINE_VERSION=${{ steps.image_env.outputs.ALPINE_VERSION }}
BASE_IMAGE_DIGEST=${{ steps.image_env.outputs.BASE_IMAGE_DIGEST }}
PYTHON_VERSION=${{ steps.image_env.outputs.PYTHON_VERSION }}
SOURCE_IMAGE=${{ steps.image_env.outputs.SOURCE_IMAGE }}
BUILD_ROOT=/d
tags: "${{ steps.image_env.outputs.REPO_TAG }}"