Skip to content

Commit f801ea2

Browse files
austin207claude
andcommitted
feat(ci): publish Docker image to GitHub Container Registry
Porter Robot Docker image now published to ghcr.io/virtusco/porter-robot on every push to main/prototype. Shows up under VirtusCo Packages tab. - Tags: version, latest (main only), commit SHA - Still saves .tar.gz artifact for GitHub Releases Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b2df800 commit f801ea2

1 file changed

Lines changed: 37 additions & 7 deletions

File tree

.github/workflows/build-release.yml

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,50 @@ jobs:
2828
echo "version=$VER" >> "$GITHUB_OUTPUT"
2929
3030
build-docker:
31-
name: Build Docker Image
31+
name: Build & Publish Docker Image
3232
runs-on: ubuntu-latest
3333
needs: version
34+
permissions:
35+
contents: read
36+
packages: write
37+
env:
38+
REGISTRY: ghcr.io
39+
IMAGE_NAME: virtusco/porter-robot
3440
steps:
3541
- uses: actions/checkout@v4
3642
with:
3743
lfs: true
38-
- name: Build production image
39-
run: |
40-
docker build -f docker/Dockerfile.prod \
41-
-t porter-robot:${{ needs.version.outputs.version }} .
42-
- name: Save image
44+
45+
- name: Log in to GitHub Container Registry
46+
uses: docker/login-action@v3
47+
with:
48+
registry: ${{ env.REGISTRY }}
49+
username: ${{ github.actor }}
50+
password: ${{ secrets.GITHUB_TOKEN }}
51+
52+
- name: Extract metadata
53+
id: meta
54+
uses: docker/metadata-action@v5
55+
with:
56+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
57+
tags: |
58+
type=raw,value=${{ needs.version.outputs.version }}
59+
type=raw,value=latest,enable=${{ github.ref_name == 'main' }}
60+
type=sha,prefix=
61+
62+
- name: Build and push Docker image
63+
uses: docker/build-push-action@v5
64+
with:
65+
context: .
66+
file: docker/Dockerfile.prod
67+
push: true
68+
tags: ${{ steps.meta.outputs.tags }}
69+
labels: ${{ steps.meta.outputs.labels }}
70+
71+
- name: Save image for release artifacts
4372
run: |
44-
docker save porter-robot:${{ needs.version.outputs.version }} | gzip > porter-robot-${{ needs.version.outputs.version }}.tar.gz
73+
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.version.outputs.version }}
74+
docker save ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.version.outputs.version }} | gzip > porter-robot-${{ needs.version.outputs.version }}.tar.gz
4575
- uses: actions/upload-artifact@v4
4676
with:
4777
name: docker-image

0 commit comments

Comments
 (0)