Skip to content

Commit c5a6027

Browse files
authored
Split dev & prod docker build-push actions (#318)
Signed-off-by: Fiachra Corcoran <fiachra.corcoran@est.tech>
1 parent e17098f commit c5a6027

2 files changed

Lines changed: 75 additions & 6 deletions

File tree

.github/workflows/dev-image-build.yaml renamed to .github/workflows/image-build-push-dev.yaml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1-
name: Dev Image Build
1+
name: Dev Image Build & Push
22

33
on:
44
push:
55
branches:
66
- main
7-
tags:
8-
- "v[0-9]+.[0-9]+.[0-9]"
9-
- "v[0-9]+.[0-9]+.[0-9]-pre[0-9]+"
107
paths-ignore:
118
- "docs/**"
129
- "release/**"
13-
- ".prow.yaml"
1410
- "OWNERS"
1511
workflow_dispatch:
1612

@@ -75,7 +71,6 @@ jobs:
7571
file: ${{ matrix.dockerfile }}
7672
push: true
7773
tags: |
78-
${{ steps.meta.outputs.tags }}
7974
${{ matrix.image }}:${{ github.ref_name == 'main' && 'latest' || github.ref_name }}
8075
labels: ${{ steps.meta.outputs.labels }}
8176
no-cache: true
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Release Image Build & Push
2+
3+
on:
4+
push:
5+
tags:
6+
- "v[0-9]+.[0-9]+.[0-9]"
7+
- "v[0-9]+.[0-9]+.[0-9]-pre[0-9]+"
8+
9+
env:
10+
REGISTRY: docker.io
11+
ORG: nephio
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
build-and-push-image:
18+
if: github.repository_owner == 'nephio-project'
19+
runs-on: ubuntu-latest
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
include:
24+
- dockerfile: ./build/Dockerfile
25+
image: docker.io/nephio/porch-server
26+
- dockerfile: ./controllers/Dockerfile
27+
image: docker.io/nephio/porch-controllers
28+
- dockerfile: ./func/Dockerfile
29+
image: docker.io/nephio/porch-function-runner
30+
- dockerfile: ./func/Dockerfile-wrapperserver
31+
image: docker.io/nephio/porch-wrapper-server
32+
permissions:
33+
contents: read
34+
packages: write
35+
36+
steps:
37+
- name: Harden Runner
38+
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
39+
with:
40+
egress-policy: audit
41+
42+
- name: Checkout repository
43+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
44+
45+
- name: Log in to the Container registry
46+
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
47+
with:
48+
registry: ${{ env.REGISTRY }}
49+
username: ${{ vars.DOCKERHUB_USERNAME }}
50+
password: ${{ secrets.DOCKERHUB_TOKEN }}
51+
52+
- name: Set up Docker Buildx
53+
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
54+
55+
- name: Extract metadata
56+
id: meta
57+
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
58+
with:
59+
images: ${{ matrix.image }}
60+
tags: |
61+
type=ref,event=tag
62+
63+
- name: Build and push Docker images
64+
uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 # v6.7.0
65+
with:
66+
context: .
67+
file: ${{ matrix.dockerfile }}
68+
push: true
69+
tags: |
70+
${{ matrix.image }}:${{ github.ref_name }}
71+
${{ steps.meta.outputs.tags }}
72+
labels: ${{ steps.meta.outputs.labels }}
73+
no-cache: true
74+
sbom: true

0 commit comments

Comments
 (0)