Skip to content

Commit d47f7a9

Browse files
author
Daniel van der Ploeg
committed
Push container image to GHCR from docker workflow
Adds a step to tag and push the locally-built monocle image to ghcr.io/aligent/monocle:dev (and a SHA tag) so the image can be pulled and run on developer machines without rebuilding from source.
1 parent dae942c commit d47f7a9

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

.github/workflows/docker.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ jobs:
22
compose:
33
name: compose-tests
44
runs-on: ubuntu-latest
5+
permissions:
6+
contents: read
7+
packages: write
58
steps:
69
- uses: "actions/checkout@v2.4.0"
710
- uses: "cachix/install-nix-action@v20"
@@ -41,6 +44,18 @@ jobs:
4144
run: "nix build .#containerMonocle; docker load < ./result"
4245
- name: Build docker image
4346
run: docker build -t quay.io/change-metrics/monocle:latest .
47+
- name: Log in to GHCR
48+
uses: docker/login-action@v3
49+
with:
50+
registry: ghcr.io
51+
username: ${{ github.actor }}
52+
password: ${{ secrets.GITHUB_TOKEN }}
53+
- name: Tag and push to GHCR
54+
run: |
55+
docker tag quay.io/change-metrics/monocle:latest ghcr.io/aligent/monocle:dev
56+
docker tag quay.io/change-metrics/monocle:latest ghcr.io/aligent/monocle:${{ github.sha }}
57+
docker push ghcr.io/aligent/monocle:dev
58+
docker push ghcr.io/aligent/monocle:${{ github.sha }}
4459
- name: Set Monocle compose image to latest
4560
run: "echo \"COMPOSE_MONOCLE_VERSION=latest\" > .env"
4661
- name: Start Monocle compose

0 commit comments

Comments
 (0)