From 5f1e2edc441554de9d538b65e9e3f38e372e829e Mon Sep 17 00:00:00 2001 From: Lukas Holzner Date: Sun, 29 Sep 2024 21:43:33 +0200 Subject: [PATCH] Added github image builder action --- .github/workflows/docker-build-push.yml | 37 +++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/docker-build-push.yml diff --git a/.github/workflows/docker-build-push.yml b/.github/workflows/docker-build-push.yml new file mode 100644 index 0000000..4bfd25f --- /dev/null +++ b/.github/workflows/docker-build-push.yml @@ -0,0 +1,37 @@ +--- +name: Docker Build and Push + +on: + push: + branches: + - main + +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Generate timestamp + id: timestamp + run: echo "::set-output name=timestamp::$(date +'%Y%m%d%H%M%S')" + + - name: Build and push Docker image + uses: docker/build-push-action@v4 + with: + context: . + push: true + tags: | + ghcr.io/${{ github.repository }}:latest + ghcr.io/${{ github.repository }}:${{ steps.timestamp.outputs.timestamp }} \ No newline at end of file