From f09db5ef5e858f3c54c0c8dde1a9aecf7046dde0 Mon Sep 17 00:00:00 2001 From: Chaitanya Rahalkar Date: Sat, 14 Dec 2024 13:24:24 -0600 Subject: [PATCH 1/5] Update docker-build.yml --- .github/workflows/docker-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 425c679e..f2dc8669 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -53,5 +53,5 @@ jobs: push: true tags: | ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:alpine - ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:alpine-{{date 'YYYYMMDD'}} - labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:alpine-${TAG_DATE} + labels: ${{ steps.meta.outputs.labels }} From 08b80c35be26b8815d310e9f3056d6633eef54a6 Mon Sep 17 00:00:00 2001 From: Chaitanya Rahalkar Date: Sat, 14 Dec 2024 14:23:08 -0600 Subject: [PATCH 2/5] Update docker-build.yml --- .github/workflows/docker-build.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index f2dc8669..6b8dad08 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -1,24 +1,25 @@ name: Build and Push Docker Images - on: schedule: - - cron: '0 0 1 * *' # Run monthly on the 1st + - cron: '0 0 1 *'* # Run monthly on the 1st workflow_dispatch: # Allow manual triggers - env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} - + TAG_DATE: ${{ format('{0}{1}{2}', github.event.repository.pushed_at.substring(0,4), github.event.repository.pushed_at.substring(5,7), github.event.repository.pushed_at.substring(8,10)) }} jobs: build-and-push: runs-on: ubuntu-latest permissions: contents: read packages: write - steps: - name: Checkout repository uses: actions/checkout@v4 + + - name: Set current date + id: date + run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV - name: Log in to the Container registry uses: docker/login-action@v3 @@ -34,7 +35,7 @@ jobs: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | type=raw,value=latest - type=raw,value={{date 'YYYYMMDD'}} + type=raw,value=${{ env.DATE }} - name: Build and push regular image uses: docker/build-push-action@v5 @@ -53,5 +54,5 @@ jobs: push: true tags: | ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:alpine - ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:alpine-${TAG_DATE} - labels: ${{ steps.meta.outputs.labels }} + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:alpine-${{ env.DATE }} + labels: ${{ steps.meta.outputs.labels }} From 63effa3ce4f499b755d9dd9ce21ab5d21fe45b43 Mon Sep 17 00:00:00 2001 From: Chaitanya Rahalkar Date: Sat, 14 Dec 2024 14:25:06 -0600 Subject: [PATCH 3/5] Update docker-build.yml --- .github/workflows/docker-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 6b8dad08..d548e667 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -1,8 +1,8 @@ name: Build and Push Docker Images on: schedule: - - cron: '0 0 1 *'* # Run monthly on the 1st - workflow_dispatch: # Allow manual triggers + - cron: '0 0 1 * *' # Run monthly on the 1st + workflow_dispatch: env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} From 58085bec3f39235409d0d4fe8fcea7455a4271d3 Mon Sep 17 00:00:00 2001 From: Chaitanya Rahalkar Date: Sat, 14 Dec 2024 14:26:05 -0600 Subject: [PATCH 4/5] Update docker-build.yml --- .github/workflows/docker-build.yml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index d548e667..611a50cf 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -2,11 +2,10 @@ name: Build and Push Docker Images on: schedule: - cron: '0 0 1 * *' # Run monthly on the 1st - workflow_dispatch: + workflow_dispatch: # Allow manual triggers env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} - TAG_DATE: ${{ format('{0}{1}{2}', github.event.repository.pushed_at.substring(0,4), github.event.repository.pushed_at.substring(5,7), github.event.repository.pushed_at.substring(8,10)) }} jobs: build-and-push: runs-on: ubuntu-latest @@ -16,10 +15,6 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - - - name: Set current date - id: date - run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV - name: Log in to the Container registry uses: docker/login-action@v3 @@ -35,7 +30,7 @@ jobs: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | type=raw,value=latest - type=raw,value=${{ env.DATE }} + type=raw,value={{date 'YYYYMMDD'}} - name: Build and push regular image uses: docker/build-push-action@v5 @@ -54,5 +49,5 @@ jobs: push: true tags: | ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:alpine - ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:alpine-${{ env.DATE }} + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:alpine-{{date 'YYYYMMDD'}} labels: ${{ steps.meta.outputs.labels }} From 018747014834ad099b1c093295ff1d7c09325dc5 Mon Sep 17 00:00:00 2001 From: Chaitanya Rahalkar Date: Sat, 14 Dec 2024 14:52:05 -0600 Subject: [PATCH 5/5] Update docker-build.yml --- .github/workflows/docker-build.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 611a50cf..b917f7de 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -32,6 +32,15 @@ jobs: type=raw,value=latest type=raw,value={{date 'YYYYMMDD'}} + - name: Extract metadata for Alpine + id: meta-alpine + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=raw,value=alpine + type=raw,prefix=alpine-,value={{date 'YYYYMMDD'}} + - name: Build and push regular image uses: docker/build-push-action@v5 with: @@ -47,7 +56,5 @@ jobs: context: . file: ./Dockerfile-alpine push: true - tags: | - ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:alpine - ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:alpine-{{date 'YYYYMMDD'}} - labels: ${{ steps.meta.outputs.labels }} + tags: ${{ steps.meta-alpine.outputs.tags }} + labels: ${{ steps.meta-alpine.outputs.labels }}