Skip to content

Merge pull request #12 from qjoly/renovate/docker-setup-buildx-action… #75

Merge pull request #12 from qjoly/renovate/docker-setup-buildx-action…

Merge pull request #12 from qjoly/renovate/docker-setup-buildx-action… #75

name: Push to Docker Hub
on:
push:
jobs:
build-image:
name: Build Docker Image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
include:
- Dockerfile: simple/Dockerfile
context: simple/
tag: simple
- Dockerfile: micro-service/Dockerfile.api
context: micro-service
tag: api
- Dockerfile: micro-service/Dockerfile.frontend
context: micro-service
tag: frontend
- Dockerfile: evil-tea/Dockerfile
context: evil-tea
tag: evil
- Dockerfile: multiversions/Dockerfile
context: multiversions/v1
tag: v1.1
- Dockerfile: multiversions/Dockerfile
context: multiversions/v2
tag: v1.2
- Dockerfile: multiversions/Dockerfile
context: multiversions/v3
tag: v1.3
- Dockerfile: multiversions/Dockerfile
context: multiversions/v4
tag: v1.4
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
username: qjoly
password: ${{ secrets.DOCKERHUB_PASS }}
- name: Checkout code
uses: actions/checkout@v4
- name: set repository name to lowercase
run: |
echo "reponame=${reponame,,}" >>${GITHUB_ENV}
env:
reponame: '${{ github.repository }}'
- name: Build and Push Docker Image
uses: docker/build-push-action@v6
with:
context: ${{ matrix.context }}
file: ${{ matrix.dockerfile }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ env.reponame }}:${{ matrix.tag }}
platforms: linux/amd64,linux/arm64