Build + Push Docker images #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: Build + Push Docker images | |
run-name: Build + Push Docker images | |
on: | |
- push | |
- workflow_dispatch | |
jobs: | |
build-and-push: | |
name: Build and Push ${{ matrix.name }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- dockerfile: ./Dockerfile | |
name: psql-dump | |
context: ./ | |
python-version: 3.11 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login into DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
logout: true | |
- name: Build + Push ${{ matrix.name }} image to DockerHub | |
uses: docker/build-push-action@v4 | |
with: | |
context: ${{ matrix.context }} | |
file: ${{ matrix.dockerfile }} | |
push: true | |
build-args: | |
PYTHON_VERSION=${{ matrix.python-version }} | |
tags: | | |
${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.name }}:${{ matrix.python-version }} | |
${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.name }}:latest |