Skip to content

Commit

Permalink
Fix image Docker image tag when pushing to registry
Browse files Browse the repository at this point in the history
  • Loading branch information
sistracia committed May 19, 2024
1 parent 16f7618 commit 397e56d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/deploy.ghcr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
tags:
- 'ghcr-*'

env:
REGISTRY: ghcr.io
IMAGE_NAME: ghcr.io/${{ github.repository }}

jobs:
push_to_registries:
name: Push Docker image to multiple registries
Expand All @@ -19,21 +23,21 @@ jobs:
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
images: ${{ env.IMAGE_NAME }}

- name: Build and push Docker images
uses: docker/build-push-action@v5
with:
context: ./web
file: ./web/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
tags: ${{ env.IMAGE_NAME }}:latest
labels: ${{ steps.meta.outputs.labels }}
12 changes: 8 additions & 4 deletions .github/workflows/deploy.private.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
tags:
- 'private-*'

env:
REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
IMAGE_NAME: ${{ secrets.DOCKER_REGISTRY }}/${{ github.repository }}

jobs:
deployment:
runs-on: ubuntu-22.04
Expand All @@ -22,7 +26,7 @@ jobs:
-
name: Ping Tailscale
run: |
curl ${{ secrets.DOCKER_REGISTRY }}
curl ${{ env.REGISTRY }}
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand All @@ -32,7 +36,7 @@ jobs:
with:
driver-opts: network=host
config-inline: |
[registry."${{ secrets.DOCKER_REGISTRY }}"]
[registry."${{ env.REGISTRY }}"]
http = true
insecure = true
-
Expand All @@ -42,10 +46,10 @@ jobs:
context: ./web
file: ./web/Dockerfile
push: true
tags: ${{ secrets.DOCKER_REGISTRY }}/rss-bookmarkr:latest
tags: ${{ env.IMAGE_NAME }}:latest
labels: |
com.centurylinklabs.watchtower.enable=true
-
name: Inspect
run: |
docker buildx imagetools inspect ${{ secrets.DOCKER_REGISTRY }}/rss-bookmarkr:latest
docker buildx imagetools inspect ${{ env.IMAGE_NAME }}:latest
2 changes: 1 addition & 1 deletion web/docker-compose.registry.private.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
web:
image: localhost:5000/rss-bookmarkr
image: localhost:5000/rss-bookmarkr:latest
container_name: rss-bookmarkr
restart: unless-stopped
network_mode: "host"
Expand Down

0 comments on commit 397e56d

Please sign in to comment.