From 151d6454b8793e471515fe87a1a3f3fdd445d2f9 Mon Sep 17 00:00:00 2001 From: vwout Date: Sat, 2 Nov 2024 14:11:43 +0100 Subject: [PATCH] Create workflow for Docker image build --- .github/workflows/build-image.yml | 49 +++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/build-image.yml diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml new file mode 100644 index 0000000..a19a66c --- /dev/null +++ b/.github/workflows/build-image.yml @@ -0,0 +1,49 @@ +name: Build and push Docker image to dockerhub + +on: + push: + branches: [ "master" ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Get variables + id: vars + run: | + echo "build_date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT + echo "vcs_ref=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT + + - name: Login to dockerhub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build Alpine and push to dockerhub + uses: docker/build-push-action@v6 + with: + context: ./openluup-alpine + push: true + build-args: | + BUILD_DATE=${{ steps.vars.outputs.build_date }} + VCS_REF=${{ steps.vars.outputs.vcs_ref }} + tags: | + vwout/openluup:alpine + + - name: Build Debian and push to dockerhub + uses: docker/build-push-action@v6 + with: + context: ./openluup-debian + push: true + build-args: | + BUILD_DATE=${{ steps.vars.outputs.build_date }} + VCS_REF=${{ steps.vars.outputs.vcs_ref }} + tags: | + vwout/openluup:latest + vwout/openluup:slim + vwout/openluup:bookworm-slim