From 63508177eb5657e5e4d63d326e492534104255b9 Mon Sep 17 00:00:00 2001 From: Alys Brooks Date: Wed, 18 Oct 2023 16:22:20 -0500 Subject: [PATCH 1/6] Add publish action. There are not clear instructions for doing it this way. --- .github/workflows/docker-image.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 0c71a85..79185e7 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -22,4 +22,12 @@ jobs: - name: Build Uberjar run: lein uberjar - name: Build the Docker image - run: docker build . --file Dockerfile --tag pronouns.alysbrooks.com:latest --tag pronouns.alysbrooks.com:${{ github.ref_name }} --tag pronouns.alysbrooks.com:$(date +%s) + run: docker build . --file Dockerfile --tag pronouns.alysbrooks.com:latest --tag pronouns.alysbrooks.com:${{ github.ref_name }} --tag pronouns.alysbrooks.com:$(date +%s) --tag ghcr.io/alysbrooks/pronouns.alysbrooks.com:${{ github.ref_name}} + - name: Log in to GitHub's Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Publish the Docker image + run: docker push ghcr.io/alysbrooks/pronouns.alysbrooks.com:${{ github.ref_name}} From 41b32ba581e0a7385346dd01965ee93fe57ce28b Mon Sep 17 00:00:00 2001 From: Alys Brooks Date: Wed, 18 Oct 2023 16:28:03 -0500 Subject: [PATCH 2/6] Try alternative name for Docker image. --- .github/workflows/docker-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 79185e7..2f28a1d 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -22,7 +22,7 @@ jobs: - name: Build Uberjar run: lein uberjar - name: Build the Docker image - run: docker build . --file Dockerfile --tag pronouns.alysbrooks.com:latest --tag pronouns.alysbrooks.com:${{ github.ref_name }} --tag pronouns.alysbrooks.com:$(date +%s) --tag ghcr.io/alysbrooks/pronouns.alysbrooks.com:${{ github.ref_name}} + run: docker build . --file Dockerfile --tag pronouns.alysbrooks.com:latest --tag pronouns.alysbrooks.com:${{ github.ref_name }} --tag pronouns.alysbrooks.com:$(date +%s) --tag ghcr.io/alysbrooks/pronouns:${{ github.ref_name}} - name: Log in to GitHub's Container registry uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 with: From 60c01348db91b2b37ad450ee6ca47baba4531ce1 Mon Sep 17 00:00:00 2001 From: Alys Brooks Date: Wed, 18 Oct 2023 16:32:04 -0500 Subject: [PATCH 3/6] Use SHA instead of ref. --- .github/workflows/docker-image.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 2f28a1d..9e3fd49 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -22,7 +22,7 @@ jobs: - name: Build Uberjar run: lein uberjar - name: Build the Docker image - run: docker build . --file Dockerfile --tag pronouns.alysbrooks.com:latest --tag pronouns.alysbrooks.com:${{ github.ref_name }} --tag pronouns.alysbrooks.com:$(date +%s) --tag ghcr.io/alysbrooks/pronouns:${{ github.ref_name}} + run: docker build . --file Dockerfile --tag pronouns.alysbrooks.com:latest --tag pronouns.alysbrooks.com:${{ github.ref_name }} --tag pronouns.alysbrooks.com:$(date +%s) --tag ghcr.io/alysbrooks/pronouns.alysbrooks.com:${{ github.sha}} - name: Log in to GitHub's Container registry uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 with: @@ -30,4 +30,4 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Publish the Docker image - run: docker push ghcr.io/alysbrooks/pronouns.alysbrooks.com:${{ github.ref_name}} + run: docker push ghcr.io/alysbrooks/pronouns.alysbrooks.com:${{ github.sha}} From 4c7856eb51c87ea5ea3261761b35916c331386e1 Mon Sep 17 00:00:00 2001 From: Alys Brooks Date: Wed, 18 Oct 2023 16:34:32 -0500 Subject: [PATCH 4/6] Hardcode registry for now. --- .github/workflows/docker-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 9e3fd49..2d046d3 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -26,7 +26,7 @@ jobs: - name: Log in to GitHub's Container registry uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 with: - registry: ${{ env.REGISTRY }} + registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Publish the Docker image From 0a1c40f7dafca099aa4ac6d70ff003c646bbc489 Mon Sep 17 00:00:00 2001 From: Alys Brooks Date: Wed, 18 Oct 2023 16:39:37 -0500 Subject: [PATCH 5/6] Add tag name to Docker image. --- .github/workflows/docker-image.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 2d046d3..d0bc4d4 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -22,7 +22,7 @@ jobs: - name: Build Uberjar run: lein uberjar - name: Build the Docker image - run: docker build . --file Dockerfile --tag pronouns.alysbrooks.com:latest --tag pronouns.alysbrooks.com:${{ github.ref_name }} --tag pronouns.alysbrooks.com:$(date +%s) --tag ghcr.io/alysbrooks/pronouns.alysbrooks.com:${{ github.sha}} + run: docker build . --file Dockerfile --tag pronouns.alysbrooks.com:latest --tag pronouns.alysbrooks.com:${{ github.ref_name }} --tag pronouns.alysbrooks.com:$(date +%s) --tag ghcr.io/alysbrooks/pronouns.alysbrooks.com:${{ github.sha}} --tag ghcr.io/alysbrooks/pronouns.alysbrooks.com:${{ github.ref_name }} - name: Log in to GitHub's Container registry uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 with: @@ -30,4 +30,6 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Publish the Docker image - run: docker push ghcr.io/alysbrooks/pronouns.alysbrooks.com:${{ github.sha}} + run: | + docker push ghcr.io/alysbrooks/pronouns.alysbrooks.com:${{ github.sha}} + docker push ghcr.io/alysbrooks/pronouns.alysbrooks.com:${{ github.ref_name }} From 0f2c6c0952d076f2a11b17a45bb4f7aa355e26ea Mon Sep 17 00:00:00 2001 From: Alys Brooks Date: Wed, 18 Oct 2023 16:43:22 -0500 Subject: [PATCH 6/6] Remove ref_name. For some reason even ref_name doesn't actually follow the branch's name, contrary to the documentation. Not sure why? --- .github/workflows/docker-image.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index d0bc4d4..2d046d3 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -22,7 +22,7 @@ jobs: - name: Build Uberjar run: lein uberjar - name: Build the Docker image - run: docker build . --file Dockerfile --tag pronouns.alysbrooks.com:latest --tag pronouns.alysbrooks.com:${{ github.ref_name }} --tag pronouns.alysbrooks.com:$(date +%s) --tag ghcr.io/alysbrooks/pronouns.alysbrooks.com:${{ github.sha}} --tag ghcr.io/alysbrooks/pronouns.alysbrooks.com:${{ github.ref_name }} + run: docker build . --file Dockerfile --tag pronouns.alysbrooks.com:latest --tag pronouns.alysbrooks.com:${{ github.ref_name }} --tag pronouns.alysbrooks.com:$(date +%s) --tag ghcr.io/alysbrooks/pronouns.alysbrooks.com:${{ github.sha}} - name: Log in to GitHub's Container registry uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 with: @@ -30,6 +30,4 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Publish the Docker image - run: | - docker push ghcr.io/alysbrooks/pronouns.alysbrooks.com:${{ github.sha}} - docker push ghcr.io/alysbrooks/pronouns.alysbrooks.com:${{ github.ref_name }} + run: docker push ghcr.io/alysbrooks/pronouns.alysbrooks.com:${{ github.sha}}