feat: alpine image #263
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: 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, alpine] | |
include: | |
- dockerfile: ubuntu22 | |
tags: | | |
main | |
latest | |
ubuntu22 | |
${{ github.ref_name }} | |
- dockerfile: ubuntu20 | |
tags: ubuntu20 | |
- dockerfile: ubuntu18 | |
tags: ubuntu18 | |
- dockerfile: alpine | |
tags: alpine | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Setup Docker buildx | |
uses: docker/setup-buildx-action@5138f76647652447004da686b2411557eaf65f33 | |
# 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@v3 | |
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@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: ${{ matrix.tags }} | |
# Set up cache | |
- name: Setup Docker build cache | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
# 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@v5 | |
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 }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max |