Skip to content

refactor: docker build #260

refactor: docker build

refactor: docker build #260

Workflow file for this run

name: Docker Build and Push
concurrency: docker-publish
on:
schedule:
- cron: '23 4 */7 * *'
push:
branches: [ main ]
tags:
- 'v*'
paths-ignore:
- README.md
pull_request:
branches: [ main ]
workflow_dispatch:
env:
REGISTRY: docker.io
IMAGE_NAME: ${{ secrets.DOCKERHUB_USER }}/backblaze-personal-wine
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
dockerfile: [ubuntu22, ubuntu20, ubuntu18]
include:
- dockerfile: ubuntu22
tags: |
main
latest
ubuntu22
${{ github.ref_name }}
- dockerfile: ubuntu20
tags: ubuntu20
- dockerfile: ubuntu18
tags: ubuntu18
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Setup Docker buildx
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: ${{ matrix.tags }}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile.${{ matrix.dockerfile }}
push: ${{ github.event_name != 'pull_request' }}
platforms: linux/amd64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}