Skip to content

Commit

Permalink
feat(ci): automatically build and push container images
Browse files Browse the repository at this point in the history
  • Loading branch information
themightychris committed Apr 19, 2024
1 parent 62e8a22 commit 287fedd
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/publish-container.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Publish Container Image
on:
push:
tags: [ 'v*' ]

jobs:
publish-container:
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v4

- name: Set version number
run: |
echo "VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
echo "DOCKER_REPOSITORY=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push controller
uses: docker/build-push-action@v2
with:
context: ./hairpin-proxy-controller
push: true
build-args: version=${{ env.VERSION }}
tags: |
ghcr.io/${{ env.DOCKER_REPOSITORY }}/controller:latest
ghcr.io/${{ env.DOCKER_REPOSITORY }}/controller:${{ env.VERSION }}
cache-from: type=registry,ref=ghcr.io/${{ env.DOCKER_REPOSITORY }}/controller:latest
cache-to: type=inline

- name: Build and push haproxy
uses: docker/build-push-action@v2
with:
context: ./hairpin-proxy-haproxy
push: true
build-args: version=${{ env.VERSION }}
tags: |
ghcr.io/${{ env.DOCKER_REPOSITORY }}/haproxy:latest
ghcr.io/${{ env.DOCKER_REPOSITORY }}/haproxy:${{ env.VERSION }}
cache-from: type=registry,ref=ghcr.io/${{ env.DOCKER_REPOSITORY }}/haproxy:latest
cache-to: type=inline

0 comments on commit 287fedd

Please sign in to comment.