-
Notifications
You must be signed in to change notification settings - Fork 3
65 lines (59 loc) · 1.86 KB
/
container.yml
File metadata and controls
65 lines (59 loc) · 1.86 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
# Main build pipeline that verifies, builds, and deploys the software
name: Build Docker image (ghcr.io)
# Events that trigger the workflow
on:
# Run workflow manually from the Actions tab
workflow_dispatch:
inputs:
version:
type: string
description: Application version to build container image for
required: true
# Only allow 1 execution of this workflow to be running at any given time per-branch.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# Environment variables
env:
IMAGE_NAME: ${{ github.repository }}
POETRY_VERSION: "2.1.1"
PYTHON_VERSION: "3.10"
REGISTRY: ghcr.io
jobs:
container:
name: Build container image
# The type of runner that the job will run on
runs-on: ubuntu-latest
env:
APP_VERSION: ${{ github.event.inputs.version }}
steps:
# Check out GitHub repo
- uses: actions/checkout@v4
with:
repository: ${{ github.repository }}
submodules: 'recursive'
# ghcr.io container image
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=pep440,pattern={{version}},value=${{ env.APP_VERSION }}
flavor: |
latest=true
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
push: true
pull: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}