forked from nautobot/nautobot
-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (58 loc) · 2.19 KB
/
build_dependency_image.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
---
# This reusable workflow always builds & tags a Docker image for the Nautobot dependencies stage
# Published as ghcr.io/nautobot/nautobot-dependencies
#
# This allows the same steps to be followed in CI on push as well as a manual trigger if so desired
name: "Build Dependencies Image"
on: # yamllint disable
workflow_call:
workflow_dispatch:
jobs:
container-build:
runs-on: "ubuntu-20.04"
strategy:
fail-fast: true
matrix:
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
env:
INVOKE_NAUTOBOT_PYTHON_VER: "${{ matrix.python-version }}"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v4"
- name: "Get Git Branch/Tag Name" # For tagging dependencies image, supports branch or tag reference
run: echo "branch=$(echo $GITHUB_REF | awk -F '/' '{print $NF}')" >> $GITHUB_OUTPUT
id: "gitbranch"
- name: "Set up QEMU"
uses: "docker/setup-qemu-action@v1"
- name: "Set up Docker Buildx"
uses: "docker/setup-buildx-action@v1"
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: "Docker Dependencies Metadata"
id: "dockerdepmeta"
uses: "docker/metadata-action@v3"
with:
images: "ghcr.io/nautobot/nautobot-dependencies"
flavor: |
latest=false
tags: |
type=raw,value=${{ steps.gitbranch.outputs.branch }}-py${{ matrix.python-version }}
labels: |
org.opencontainers.image.title=Nautobot Dependencies Base Image
- name: "Build Dependencies Containers"
uses: "docker/build-push-action@v2"
with:
push: true
target: dependencies
file: "docker/Dockerfile"
platforms: "linux/amd64,linux/arm64"
tags: "${{ steps.dockerdepmeta.outputs.tags }}"
labels: "${{ steps.dockerdepmeta.outputs.labels }}"
context: "."
build-args: |
PYTHON_VER=${{ matrix.python-version }}
DEPENDENCIES_BASE_BRANCH=${{ steps.gitbranch.outputs.branch }}