DockerHub #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: publish-image | |
on: | |
push: | |
branches: [ "release" ] | |
pull_request: | |
branches: [ "release" ] | |
jobs: | |
build: | |
name: Build Docker image | |
runs-on: ubuntu-latest # specify the build machine | |
steps: | |
- # checkout to the repository on the build machine | |
name: Checkout | |
uses: actions/checkout@v3 | |
- # login to Docker Hub using the secrets provided | |
name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to GHCR | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
uses: docker/login-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build and Push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: | | |
dziedzicgrzegorz/nestjs-api:latest | |
ghcr.io/dziedzicgrzegorz/nestjs-api:latest | |