Updating workflow

This commit is contained in:
Mehdi Benadel 2022-12-24 16:44:58 +01:00 committed by Mehdi Zakaria Benadel (Rebase PR Action)
parent b1ff44ca2f
commit 5541af4f4b

View file

@ -2,38 +2,68 @@
name: Build Docker image name: Build Docker image
on: on:
workflow_dispatch:
push: push:
branches: branches:
- dev - dev
tags:
- '*'
pull_request:
paths:
- .github/workflows/build-docker.yml
- contrib/docker/Dockerfile.apache
permissions:
contents: read
jobs: jobs:
build_regular_docker: build-docker:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout Code - name: Checkout Code
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Docker Lint
uses: hadolint/hadolint-action@v3.0.0
with:
dockerfile: contrib/docker/Dockerfile.apache
failure-threshold: error
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v1 uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v2
- name: Login to DockerHub - name: Login to DockerHub
uses: docker/login-action@v1 uses: docker/login-action@v2
with: with:
username: ${{ secrets.DOCKER_HUB_USERNAME }} username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }} password: ${{ secrets.DOCKER_HUB_TOKEN }}
if: github.event_name != 'pull_request'
- name: Fetch tags
uses: docker/metadata-action@v4
id: meta
with:
images: ${{ secrets.DOCKER_HUB_ORGANISATION }}/pixelfed
flavor: |
latest=auto
tags: |
type=edge,branch=dev
type=pep440,pattern={{raw}}
type=pep440,pattern=v{{major}}.{{minor}}
type=ref,event=pr
- name: Build and push Docker image - name: Build and push Docker image
uses: docker/build-push-action@v2 uses: docker/build-push-action@v3
with: with:
context: . context: .
file: ./contrib/docker/Dockerfile.apache file: contrib/docker/Dockerfile.apache
platforms: linux/amd64,linux/arm64,linux/arm/v7 platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true builder: ${{ steps.buildx.outputs.name }}
tags: ${{ secrets.DOCKER_HUB_ORGANISATION }}/pixelfed:latest push: ${{ github.event_name != 'pull_request' }}
cache-from: type=registry,ref=user/app:latest tags: ${{ steps.meta.outputs.tags }}
cache-to: type=inline cache-from: type=gha
cache-to: type=gha,mode=max