Skip to content

Commit 42d862b

Browse files
committed
feat: add quay.expires-after label and unify build workflow
- Add QUAY_IMAGE_EXPIRY build arg and quay.expires-after label to Dockerfile - Expiry set to 'never' for main branch and release tags - Expiry set to '3w' for all other refs (e.g. manual workflow dispatch) - Remove dev-build.yaml and release-build.yaml - Add build-push.yaml to handle pushes, releases, and workflow dispatch Signed-off-by: Arpit Tripathi <arpittripathiayo@gmail.com>
1 parent 6af1cde commit 42d862b

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

.github/workflows/build-push.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,17 @@ jobs:
5252
# Manual: git sha as fallback
5353
type=raw,value=${{ github.sha }},enable=${{ github.event_name == 'workflow_dispatch' }}
5454
55+
- name: Read quay image expiry
56+
id: quay-expiry
57+
run: |
58+
if [[ "${{ github.ref_name }}" == "main" || "${{ github.ref_type }}" == "tag" && "${{ github.ref_name }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-.*)?$ ]]; then
59+
echo "expiry=never" >> $GITHUB_OUTPUT
60+
echo "Setting expiry to 'never' for ref ${{ github.ref_name }}"
61+
else
62+
echo "expiry=3w" >> $GITHUB_OUTPUT
63+
echo "Setting expiry to '3w' for ref ${{ github.ref_name }}"
64+
fi
65+
5566
- name: Build and Push Image
5667
if: github.repository_owner == 'kuadrant'
5768
uses: docker/build-push-action@v5
@@ -62,6 +73,8 @@ jobs:
6273
push: true
6374
provenance: false
6475
tags: ${{ steps.meta.outputs.tags }}
76+
build-args: |
77+
QUAY_IMAGE_EXPIRY=${{ steps.quay-expiry.outputs.expiry }}
6578
6679
- name: Print Image URL
6780
run: |

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,8 @@ RUN mkdir -p /var/cache/nginx /var/log/nginx /run && \
4141
COPY --from=builder /usr/src/app/dist/ /usr/share/nginx/html/
4242
COPY entrypoint.sh /usr/share/nginx/html/entrypoint.sh
4343

44+
ARG QUAY_IMAGE_EXPIRY="never"
45+
LABEL quay.expires-after=${QUAY_IMAGE_EXPIRY}
46+
4447
USER 1001
4548
ENTRYPOINT ["/usr/share/nginx/html/entrypoint.sh"]

0 commit comments

Comments
 (0)