From 758c4c813a5eb02aea0ec25109ce426098709549 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Fri, 13 Dec 2024 15:31:52 +0100 Subject: [PATCH 1/5] Split image build and push --- .github/workflows/build.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2aae45f..88133e3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -62,8 +62,14 @@ jobs: ${{ env.FULL_VERSION }} ${{ env.MAJOR_VERSION }} - - name: Build and push Docker image - id: build-and-push + - name: Build Docker image + id: build + uses: docker/build-push-action@v2 + with: + context: . + + - name: Push Docker image + id: push uses: docker/build-push-action@v2 with: context: . From aee6dc8d0111ac24f1060460369ce4d036876803 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Fri, 13 Dec 2024 15:40:21 +0100 Subject: [PATCH 2/5] Do not upload images for pull request --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 88133e3..38bafb2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -70,6 +70,7 @@ jobs: - name: Push Docker image id: push + if: github.event_name != 'pull_request' uses: docker/build-push-action@v2 with: context: . From 996eefa85881c630d3b2f7363cc21613bb55ab8a Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Fri, 13 Dec 2024 18:20:55 +0100 Subject: [PATCH 3/5] Load image to local docker store after build --- .github/workflows/build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 38bafb2..844b175 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -62,10 +62,12 @@ jobs: ${{ env.FULL_VERSION }} ${{ env.MAJOR_VERSION }} - - name: Build Docker image + - name: Build and export Docker image to Docker id: build uses: docker/build-push-action@v2 with: + load: true + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:test context: . - name: Push Docker image From 5b0c07e2d8e0ef76b8a4efceb1d26d5ac47ffd9a Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Fri, 13 Dec 2024 18:56:18 +0100 Subject: [PATCH 4/5] Fixing output steps --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 844b175..198a289 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -84,4 +84,4 @@ jobs: if: ${{ github.event_name != 'pull_request' }} env: COSIGN_EXPERIMENTAL: "true" - run: cosign sign --yes ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build-and-push.outputs.digest }} + run: cosign sign --yes ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.push.outputs.digest }} From ec5ddfc310ec4d144bcc7c116f0f6a93dfa33219 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Fri, 13 Dec 2024 19:06:30 +0100 Subject: [PATCH 5/5] Adding rudimental image test --- .github/workflows/build.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 198a289..61ea1d3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -70,6 +70,13 @@ jobs: tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:test context: . + - name: Test Docker image + id: test-image + run: | + docker run -d -p 8888:8888 --name nextcloud --rm ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:test && \ + docker exec nextcloud occ status && \ + nc -z localhost 8888 + - name: Push Docker image id: push if: github.event_name != 'pull_request'