2023-04-30 15:51:46 +02:00
|
|
|
name: Build and publish Docker images
|
2021-04-01 12:14:32 +02:00
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
2021-04-07 17:10:37 +02:00
|
|
|
schedule:
|
2022-12-03 14:30:40 +01:00
|
|
|
- cron: "0 0 * * 1"
|
2021-04-01 12:14:32 +02:00
|
|
|
push:
|
|
|
|
branches:
|
2021-04-05 13:13:20 +02:00
|
|
|
- main
|
2021-04-01 12:14:32 +02:00
|
|
|
tags:
|
2022-12-03 14:30:40 +01:00
|
|
|
- "*.*.*"
|
2021-04-01 12:14:32 +02:00
|
|
|
paths-ignore:
|
2022-12-03 14:30:40 +01:00
|
|
|
- "test/*"
|
|
|
|
- ".gitignore"
|
|
|
|
- "docker-compose-separate-containers.yml"
|
|
|
|
- "docker-compose.yml"
|
|
|
|
- "LICENSE"
|
|
|
|
- "Makefile"
|
|
|
|
- "*.md"
|
2021-04-01 12:14:32 +02:00
|
|
|
|
|
|
|
jobs:
|
2023-05-15 22:22:05 +02:00
|
|
|
multiarch-build:
|
|
|
|
name: Build and publish image
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
base: [alpine, debian]
|
2021-04-01 12:14:32 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2023-09-11 04:10:00 +00:00
|
|
|
uses: actions/checkout@v4
|
2021-04-01 12:14:32 +02:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2022-12-03 14:30:40 +01:00
|
|
|
|
2023-05-02 05:21:41 +02:00
|
|
|
- name: Retrieve nginx-proxy version
|
|
|
|
id: nginx-proxy_version
|
|
|
|
run: echo "VERSION=$(git describe --tags)" >> "$GITHUB_OUTPUT"
|
2021-04-06 00:11:53 +02:00
|
|
|
|
2023-05-02 05:21:41 +02:00
|
|
|
- name: Retrieve docker-gen version
|
|
|
|
id: docker-gen_version
|
2023-05-15 22:22:05 +02:00
|
|
|
run: sed -n -e 's;^FROM nginxproxy/docker-gen:\([0-9.]*\).*;VERSION=\1;p' Dockerfile.${{ matrix.base }} >> "$GITHUB_OUTPUT"
|
2021-04-06 00:11:53 +02:00
|
|
|
|
2023-05-15 22:22:05 +02:00
|
|
|
- name: Get Docker tags
|
|
|
|
id: docker_meta
|
2023-09-18 04:08:13 +00:00
|
|
|
uses: docker/metadata-action@v5
|
2021-04-01 12:14:32 +02:00
|
|
|
with:
|
2021-04-02 00:39:41 +02:00
|
|
|
images: |
|
2022-03-04 11:10:14 +01:00
|
|
|
ghcr.io/nginx-proxy/nginx-proxy
|
2021-04-02 00:39:41 +02:00
|
|
|
nginxproxy/nginx-proxy
|
|
|
|
jwilder/nginx-proxy
|
|
|
|
tags: |
|
2023-05-15 22:22:05 +02:00
|
|
|
type=semver,pattern={{version}},enable=${{ matrix.base == 'debian' }}
|
|
|
|
type=semver,pattern={{major}}.{{minor}},enable=${{ matrix.base == 'debian' }}
|
|
|
|
type=semver,suffix=-alpine,pattern={{version}},enable=${{ matrix.base == 'alpine' }}
|
|
|
|
type=semver,suffix=-alpine,pattern={{major}}.{{minor}},enable=${{ matrix.base == 'alpine' }}
|
|
|
|
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' && matrix.base == 'debian' }}
|
|
|
|
type=raw,value=alpine,enable=${{ github.ref == 'refs/heads/main' && matrix.base == 'alpine' }}
|
2022-01-14 14:29:03 +01:00
|
|
|
labels: |
|
2022-01-14 14:39:33 +01:00
|
|
|
org.opencontainers.image.authors=Nicolas Duchon <nicolas.duchon@gmail.com> (@buchdag), Jason Wilder
|
2023-05-08 15:36:04 +02:00
|
|
|
org.opencontainers.image.version=${{ steps.nginx-proxy_version.outputs.VERSION }}
|
2023-05-15 22:22:05 +02:00
|
|
|
flavor: |
|
|
|
|
latest=false
|
2021-04-01 12:14:32 +02:00
|
|
|
|
|
|
|
- name: Set up QEMU
|
2023-09-18 04:08:10 +00:00
|
|
|
uses: docker/setup-qemu-action@v3
|
2021-04-06 00:11:53 +02:00
|
|
|
|
2021-04-01 12:14:32 +02:00
|
|
|
- name: Set up Docker Buildx
|
2023-09-18 04:08:08 +00:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2021-04-06 00:11:53 +02:00
|
|
|
|
2021-04-01 12:14:32 +02:00
|
|
|
- name: Login to DockerHub
|
2023-09-18 04:08:20 +00:00
|
|
|
uses: docker/login-action@v3
|
2021-04-01 12:14:32 +02:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
2022-12-03 14:30:40 +01:00
|
|
|
|
2022-03-04 11:10:14 +01:00
|
|
|
- name: Log in to GitHub Container Registry
|
2023-09-18 04:08:20 +00:00
|
|
|
uses: docker/login-action@v3
|
2022-03-04 11:10:14 +01:00
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
2021-04-01 12:14:32 +02:00
|
|
|
|
2023-05-15 22:22:05 +02:00
|
|
|
- name: Build and push the image
|
|
|
|
id: docker_build
|
2023-12-07 23:22:02 +00:00
|
|
|
uses: docker/build-push-action@v5
|
2021-04-01 12:14:32 +02:00
|
|
|
with:
|
2021-09-08 14:25:56 +02:00
|
|
|
context: .
|
2023-05-15 22:22:05 +02:00
|
|
|
file: Dockerfile.${{ matrix.base }}
|
2023-05-02 05:21:41 +02:00
|
|
|
build-args: |
|
|
|
|
NGINX_PROXY_VERSION=${{ steps.nginx-proxy_version.outputs.VERSION }}
|
|
|
|
DOCKER_GEN_VERSION=${{ steps.docker-gen_version.outputs.VERSION }}
|
2021-04-01 22:23:37 +02:00
|
|
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
2021-04-01 12:14:32 +02:00
|
|
|
push: true
|
2023-05-15 22:22:05 +02:00
|
|
|
tags: ${{ steps.docker_meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.docker_meta.outputs.labels }}
|
2023-05-15 22:23:58 +02:00
|
|
|
cache-from: type=gha
|
|
|
|
cache-to: type=gha,mode=max
|
2021-04-01 12:14:32 +02:00
|
|
|
|
|
|
|
- name: Images digests
|
2023-05-15 22:22:05 +02:00
|
|
|
run: echo ${{ steps.docker_build.outputs.digest }}
|