Skip to content

Commit 0a35ed9

Browse files
feat(ci): automatically build and push container images
1 parent 62e8a22 commit 0a35ed9

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Publish Container Images
2+
on:
3+
push:
4+
tags: [ 'v*' ]
5+
6+
jobs:
7+
publish-containers:
8+
runs-on: ubuntu-latest
9+
steps:
10+
11+
- uses: actions/checkout@v4
12+
13+
- name: Set version number
14+
run: |
15+
echo "VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
16+
echo "DOCKER_REPOSITORY=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV
17+
18+
- name: Login to GitHub Container Registry
19+
uses: docker/login-action@v1
20+
with:
21+
registry: ghcr.io
22+
username: ${{ github.repository_owner }}
23+
password: ${{ secrets.GITHUB_TOKEN }}
24+
25+
- name: Build and push controller
26+
uses: docker/build-push-action@v2
27+
with:
28+
context: ./hairpin-proxy-controller
29+
push: true
30+
build-args: version=${{ env.VERSION }}
31+
tags: |
32+
ghcr.io/${{ env.DOCKER_REPOSITORY }}/controller:latest
33+
ghcr.io/${{ env.DOCKER_REPOSITORY }}/controller:${{ env.VERSION }}
34+
cache-from: type=registry,ref=ghcr.io/${{ env.DOCKER_REPOSITORY }}/controller:latest
35+
cache-to: type=inline
36+
37+
- name: Build and push haproxy
38+
uses: docker/build-push-action@v2
39+
with:
40+
context: ./hairpin-proxy-haproxy
41+
push: true
42+
build-args: version=${{ env.VERSION }}
43+
tags: |
44+
ghcr.io/${{ env.DOCKER_REPOSITORY }}/haproxy:latest
45+
ghcr.io/${{ env.DOCKER_REPOSITORY }}/haproxy:${{ env.VERSION }}
46+
cache-from: type=registry,ref=ghcr.io/${{ env.DOCKER_REPOSITORY }}/haproxy:latest
47+
cache-to: type=inline

0 commit comments

Comments
 (0)