Skip to content

Commit

Permalink
build and publish image to Docker Hub (#203)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexjustesen authored Dec 12, 2022
1 parent 010cdd5 commit eb69962
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions .github/workflows/publish-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ env:
PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7

jobs:
build-and-push-image:
runs-on: ubuntu-latest
build_and_push_image:
name: Build and push Docker image
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
Expand Down Expand Up @@ -50,11 +51,31 @@ jobs:
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
- name: Build and push image to GHCR
uses: docker/build-push-action@v3
with:
context: .
push: true
platforms: ${{ env.PLATFORMS }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ajustesen/${{ env.IMAGE_NAME }}

- name: Build and push image to Docker Hub
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit eb69962

Please sign in to comment.