Skip to content

Commit b325efb

Browse files
dpark01claude
andcommitted
Add OCI labels, manifest annotations, and registry cleanup jobs
- Add OCI labels to Dockerfile (source, description, licenses) - Add annotations to multi-arch manifest for ghcr.io visibility - Add cleanup-untagged job to remove old untagged versions on main push - Add cleanup-branch-images job to delete branch images when branch deleted Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent d3f0c29 commit b325efb

File tree

2 files changed

+56
-1
lines changed

2 files changed

+56
-1
lines changed

.github/workflows/docker.yml

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
pull_request:
88
branches: [main]
99
merge_group:
10+
delete: # Trigger cleanup when branches are deleted
1011

1112
env:
1213
REGISTRY: ghcr.io
@@ -128,7 +129,57 @@ jobs:
128129
echo "$TAGS" | while IFS= read -r tag; do
129130
[ -z "$tag" ] && continue
130131
echo "Creating manifest for: $tag"
131-
docker buildx imagetools create -t "$tag" \
132+
docker buildx imagetools create \
133+
--annotation "index:org.opencontainers.image.description=ML-guided qPCR primer design with off-target minimization" \
134+
--annotation "index:org.opencontainers.image.source=https://github.com/broadinstitute/qprimer_designer" \
135+
--annotation "index:org.opencontainers.image.licenses=MIT" \
136+
-t "$tag" \
132137
"${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${SUFFIX}-amd64" \
133138
"${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${SUFFIX}-arm64"
134139
done
140+
141+
cleanup-untagged:
142+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
143+
needs: [create-manifest]
144+
runs-on: ubuntu-latest
145+
permissions:
146+
packages: write
147+
steps:
148+
- uses: actions/delete-package-versions@v5
149+
with:
150+
package-name: qprimer_designer
151+
package-type: container
152+
min-versions-to-keep: 5
153+
delete-only-untagged-versions: true
154+
155+
cleanup-branch-images:
156+
if: github.event_name == 'delete' && github.event.ref_type == 'branch'
157+
runs-on: ubuntu-latest
158+
permissions:
159+
packages: write
160+
steps:
161+
- name: Delete branch images from ghcr.io
162+
env:
163+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
164+
run: |
165+
# Sanitize branch name (same logic as build jobs)
166+
SUFFIX=$(echo '${{ github.event.ref }}' | tr '/' '-')
167+
168+
for arch in amd64 arm64; do
169+
TAG="${SUFFIX}-${arch}"
170+
echo "Looking for tag: $TAG"
171+
172+
# Get version ID for this tag
173+
VERSION_ID=$(gh api \
174+
"orgs/${{ github.repository_owner }}/packages/container/qprimer_designer/versions" \
175+
--jq ".[] | select(.metadata.container.tags | contains([\"$TAG\"])) | .id" \
176+
2>/dev/null || true)
177+
178+
if [ -n "$VERSION_ID" ]; then
179+
gh api --method DELETE \
180+
"orgs/${{ github.repository_owner }}/packages/container/qprimer_designer/versions/$VERSION_ID"
181+
echo "Deleted version $VERSION_ID (tag: $TAG)"
182+
else
183+
echo "Tag $TAG not found, skipping"
184+
fi
185+
done

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
FROM mambaorg/micromamba:2.5.0-debian12-slim
22

3+
LABEL org.opencontainers.image.source="https://github.com/broadinstitute/qprimer_designer"
4+
LABEL org.opencontainers.image.description="ML-guided qPCR primer design with off-target minimization"
5+
LABEL org.opencontainers.image.licenses="MIT"
6+
37
# Layer 1: Conda environment (cached unless environment.yml changes)
48
COPY --chown=$MAMBA_USER:$MAMBA_USER environment.yml /tmp/environment.yml
59
RUN micromamba install -y -n base -f /tmp/environment.yml && \

0 commit comments

Comments
 (0)