From 1eb0abca2bd340e7bf427e6b5ed75f521cc821e4 Mon Sep 17 00:00:00 2001 From: Vladislav Safonov <29694249+ntdesmond@users.noreply.github.com> Date: Mon, 1 May 2023 16:37:09 +0300 Subject: [PATCH 1/2] Create Docker build workflow --- .github/workflows/build-push-docker | 61 +++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/build-push-docker diff --git a/.github/workflows/build-push-docker b/.github/workflows/build-push-docker new file mode 100644 index 0000000..ae1e336 --- /dev/null +++ b/.github/workflows/build-push-docker @@ -0,0 +1,61 @@ +name: Build Docker image and push to GHCR + +on: + # Can be triggered manually + workflow_dispatch: + # Runs automatically on pushes (merges) to the branch + push: + branches: + - master + +# Allow one concurrent build +concurrency: build-and-push + +# Least required permissions +permissions: + contents: read + packages: write + +env: + # Has to be in form ghcr.io/USER/REPO_NAME + # github.repository is exactly USER/REPO_NAME part + IMAGE_NAME: ghcr.io/${{ github.repository }} + +jobs: + build: + timeout-minutes: 5 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Login to GHCR + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v2 + + - name: Build and push + uses: docker/build-push-action@v3 + with: + builder: ${{ steps.buildx.outputs.name }} + + # Build options + context: ./ + file: ./Dockerfile + tags: ${{ env.IMAGE_NAME }}:latest + + # Push the result to the registry + push: true + + # Cache layers in the registry + cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:buildcache + cache-to: type=registry,ref=${{ env.IMAGE_NAME }}:buildcache,mode=max + + # Label to link the resulting package to the current repository + labels: | + org.opencontainers.image.source=${{ github.repositoryUrl }} From 575679b6fb79ec26634f6ac6ce279fa1e85b5856 Mon Sep 17 00:00:00 2001 From: Vladislav Safonov <29694249+ntdesmond@users.noreply.github.com> Date: Mon, 1 May 2023 16:37:53 +0300 Subject: [PATCH 2/2] I missed the extension bruh --- .github/workflows/{build-push-docker => build-push-docker.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{build-push-docker => build-push-docker.yaml} (100%) diff --git a/.github/workflows/build-push-docker b/.github/workflows/build-push-docker.yaml similarity index 100% rename from .github/workflows/build-push-docker rename to .github/workflows/build-push-docker.yaml