Skip to content

Commit

Permalink
feat: add pushing to docker-hub
Browse files Browse the repository at this point in the history
  • Loading branch information
sp-aaflalo committed Mar 7, 2024
1 parent ac34249 commit b58b351
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ env:
IMAGE_NAME: ${{ github.repository }}
DOCKER_REPO: ghcr.io/${{ github.repository }}
DOCKER_REPO_DEV: ghcr.io/${{ github.repository }}-dev
IMAGE_DOCKER_HUB: belphemur/mailcatcher-exim-courrier

jobs:
build:
Expand Down Expand Up @@ -139,3 +140,34 @@ jobs:
BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
VCS_REF=$(git rev-parse --short HEAD)
VERSION=${{ steps.version.outputs.version }}
- name: Extract Docker Hub metadata
id: meta-hub
if: github.event_name != 'pull_request'
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_DOCKER_HUB }}
tags: |
type=semver,pattern={{version}},value=${{ steps.version.outputs.version }}
- name: Log into registry Docker hub
if: github.event_name != 'pull_request'
uses: docker/#-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker image ${{ matrix.platform }} to Docker Hub
id: build-and-push
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: ${{ matrix.platform }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta-hub.outputs.tags }}
labels: ${{ steps.meta-hub.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
VCS_REF=$(git rev-parse --short HEAD)
VERSION=${{ steps.version.outputs.version }}

0 comments on commit b58b351

Please # to comment.