1
0
Fork 0
pixelfed/.github/workflows/build-docker.yml

126 lines
3.4 KiB
YAML
Raw Normal View History

---
name: Build Docker image
on:
2022-12-24 15:44:58 +00:00
workflow_dispatch:
push:
branches:
- dev
2022-12-24 15:44:58 +00:00
tags:
- '*'
pull_request:
paths:
- .github/workflows/build-docker.yml
- contrib/docker/Dockerfile.apache
2023-01-07 21:58:48 +00:00
- contrib/docker/Dockerfile.fpm
2022-12-24 15:44:58 +00:00
permissions:
contents: read
jobs:
2023-01-07 21:58:48 +00:00
build-docker-apache:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
2022-12-24 15:44:58 +00:00
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
2022-12-24 15:44:58 +00:00
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
2022-12-24 15:44:58 +00:00
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
2022-12-24 15:44:58 +00:00
uses: docker/login-action@v2
2023-01-08 22:03:28 +00:00
secrets: inherit
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
2022-12-24 15:44:58 +00:00
if: github.event_name != 'pull_request'
- name: Fetch tags
uses: docker/metadata-action@v4
2023-01-08 22:03:28 +00:00
secrets: inherit
2022-12-24 15:44:58 +00:00
id: meta
with:
images: ${{ secrets.DOCKER_HUB_ORGANISATION }}/pixelfed
flavor: |
latest=auto
2023-01-07 22:57:36 +00:00
suffix=-apache
2022-12-24 15:44:58 +00:00
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
2022-12-24 15:44:58 +00:00
uses: docker/build-push-action@v3
with:
context: .
2022-12-24 15:44:58 +00:00
file: contrib/docker/Dockerfile.apache
2023-01-08 07:01:06 +00:00
platforms: linux/amd64,linux/arm64
2022-12-24 15:44:58 +00:00
builder: ${{ steps.buildx.outputs.name }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
2023-01-07 21:58:48 +00:00
build-docker-fpm:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Docker Lint
uses: hadolint/hadolint-action@v3.0.0
with:
dockerfile: contrib/docker/Dockerfile.fpm
failure-threshold: error
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
2023-01-08 22:03:28 +00:00
secrets: inherit
2023-01-07 21:58:48 +00:00
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
if: github.event_name != 'pull_request'
- name: Fetch tags
uses: docker/metadata-action@v4
2023-01-08 22:03:28 +00:00
secrets: inherit
2023-01-07 21:58:48 +00:00
id: meta
with:
images: ${{ secrets.DOCKER_HUB_ORGANISATION }}/pixelfed
flavor: |
2023-01-07 22:57:36 +00:00
suffix=-fpm
2023-01-07 21:58:48 +00:00
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
uses: docker/build-push-action@v3
with:
context: .
file: contrib/docker/Dockerfile.fpm
2023-01-08 07:01:06 +00:00
platforms: linux/amd64,linux/arm64
2023-01-07 21:58:48 +00:00
builder: ${{ steps.buildx.outputs.name }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max