-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (89 loc) · 3 KB
/
Copy pathbuild_container.yaml
File metadata and controls
100 lines (89 loc) · 3 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
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
name: Build and Publish Containers
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: "0 0 * * *"
env:
GITHUB_IMAGE: ozy-viking/python-nginx
DOCKER_IMAGE: ozyviking/python-nginx
REGISTRY: ghcr.io
MAIN_NGINX: "mainline"
MAIN_PYTHON: "3.11"
MAIN_OS: "bookworm"
permissions:
contents: write
packages: write
jobs:
build:
strategy:
fail-fast: false
matrix:
nginx: [mainline, stable]
os: [bookworm, alpine, bullseye]
python: ["3.11", "3.10", "3.9"]
exclude:
- nginx: stable
os: bookworm
- nginx: mainline
os: bullseye
runs-on: ubuntu-latest
steps:
- name: "Checkout Branch: ${{ github.ref_name }}"
id: build_checkout
uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install poetry
poetry config virtualenvs.create false
poetry install
- name: Make dockerfiles
run: makedocker --python ${{ matrix.python }} --nginx ${{ matrix.nginx }} --os ${{ matrix.os }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker
uses: docker/login-action@v2
with:
username: ozyviking
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
- name: Container Meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
${{env.REGISTRY}}/${{env.GITHUB_IMAGE}}
${{env.DOCKER_IMAGE}}
tags: |
type=raw,enable=${{(matrix.os == env.MAIN_OS)&&(matrix.nginx == env.MAIN_NGINX)&&(matrix.python == env.MAIN_PYTHON)}},value=latest
type=raw,enable=${{(matrix.os == env.MAIN_OS)&&(matrix.nginx == env.MAIN_NGINX)}},value=${{ matrix.python }}
type=raw,enable=${{(matrix.nginx == env.MAIN_NGINX)&&(matrix.python == env.MAIN_PYTHON)}},value=${{ matrix.os }}
type=raw,enable=${{(matrix.os == env.MAIN_OS)&&(matrix.python == env.MAIN_PYTHON)}},value=${{ matrix.nginx }}
type=raw,enable=true,value=${{ matrix.python }}-${{ matrix.nginx }}-${{ matrix.os }}
- name: check output
run: echo "${{steps.meta.outputs.tags}}"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build container and push
uses: docker/build-push-action@v4
with:
push: true
platforms: linux/amd64
context: build/${{ matrix.nginx }}/${{ matrix.os }}/${{ matrix.python }}
tags: |
${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max