mirror of
https://github.com/thib8956/nginx-proxy
synced 2025-02-24 17:58:16 +00:00
Merge pull request #2245 from nginx-proxy/build-workflow
ci: image build and publish workflow update
This commit is contained in:
commit
57a350364d
114
.github/workflows/build-publish.yml
vendored
114
.github/workflows/build-publish.yml
vendored
@ -19,8 +19,11 @@ on:
|
|||||||
- "*.md"
|
- "*.md"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
multiarch-build-debian:
|
multiarch-build:
|
||||||
name: Build and publish Debian image
|
name: Build and publish image
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
base: [alpine, debian]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@ -32,8 +35,12 @@ jobs:
|
|||||||
id: nginx-proxy_version
|
id: nginx-proxy_version
|
||||||
run: echo "VERSION=$(git describe --tags)" >> "$GITHUB_OUTPUT"
|
run: echo "VERSION=$(git describe --tags)" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Get Docker tags for Debian based image
|
- name: Retrieve docker-gen version
|
||||||
id: docker_meta_debian
|
id: docker-gen_version
|
||||||
|
run: sed -n -e 's;^FROM nginxproxy/docker-gen:\([0-9.]*\).*;VERSION=\1;p' Dockerfile.${{ matrix.base }} >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Get Docker tags
|
||||||
|
id: docker_meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
images: |
|
images: |
|
||||||
@ -41,12 +48,17 @@ jobs:
|
|||||||
nginxproxy/nginx-proxy
|
nginxproxy/nginx-proxy
|
||||||
jwilder/nginx-proxy
|
jwilder/nginx-proxy
|
||||||
tags: |
|
tags: |
|
||||||
type=semver,pattern={{version}}
|
type=semver,pattern={{version}},enable=${{ matrix.base == 'debian' }}
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
type=semver,pattern={{major}}.{{minor}},enable=${{ matrix.base == 'debian' }}
|
||||||
type=raw,value=latest,enable={{is_default_branch}}
|
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' }}
|
||||||
labels: |
|
labels: |
|
||||||
org.opencontainers.image.authors=Nicolas Duchon <nicolas.duchon@gmail.com> (@buchdag), Jason Wilder
|
org.opencontainers.image.authors=Nicolas Duchon <nicolas.duchon@gmail.com> (@buchdag), Jason Wilder
|
||||||
org.opencontainers.image.version=${{ steps.nginx-proxy_version.outputs.VERSION }}
|
org.opencontainers.image.version=${{ steps.nginx-proxy_version.outputs.VERSION }}
|
||||||
|
flavor: |
|
||||||
|
latest=false
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
@ -67,93 +79,21 @@ jobs:
|
|||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Retrieve docker-gen version
|
- name: Build and push the image
|
||||||
id: docker-gen_version
|
id: docker_build
|
||||||
run: sed -n -e 's;^FROM nginxproxy/docker-gen:\([0-9.]*\).*;VERSION=\1;p' Dockerfile >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
- name: Build and push the Debian based image
|
|
||||||
id: docker_build_debian
|
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: Dockerfile
|
file: Dockerfile.${{ matrix.base }}
|
||||||
build-args: |
|
build-args: |
|
||||||
NGINX_PROXY_VERSION=${{ steps.nginx-proxy_version.outputs.VERSION }}
|
NGINX_PROXY_VERSION=${{ steps.nginx-proxy_version.outputs.VERSION }}
|
||||||
DOCKER_GEN_VERSION=${{ steps.docker-gen_version.outputs.VERSION }}
|
DOCKER_GEN_VERSION=${{ steps.docker-gen_version.outputs.VERSION }}
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.docker_meta_debian.outputs.tags }}
|
tags: ${{ steps.docker_meta.outputs.tags }}
|
||||||
labels: ${{ steps.docker_meta_debian.outputs.labels }}
|
labels: ${{ steps.docker_meta.outputs.labels }}
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
- name: Images digests
|
- name: Images digests
|
||||||
run: echo ${{ steps.docker_build_debian.outputs.digest }}
|
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||||
|
|
||||||
multiarch-build-alpine:
|
|
||||||
name: Build and publish Alpine image
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Retrieve nginx-proxy version
|
|
||||||
id: nginx-proxy_version
|
|
||||||
run: echo "VERSION=$(git describe --tags)" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
- name: Get Docker tags for Alpine based image
|
|
||||||
id: docker_meta_alpine
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: |
|
|
||||||
ghcr.io/nginx-proxy/nginx-proxy
|
|
||||||
nginxproxy/nginx-proxy
|
|
||||||
jwilder/nginx-proxy
|
|
||||||
tags: |
|
|
||||||
type=semver,suffix=-alpine,pattern={{version}}
|
|
||||||
type=semver,suffix=-alpine,pattern={{major}}.{{minor}}
|
|
||||||
type=raw,value=alpine,enable={{is_default_branch}}
|
|
||||||
labels: |
|
|
||||||
org.opencontainers.image.authors=Nicolas Duchon <nicolas.duchon@gmail.com> (@buchdag), Jason Wilder
|
|
||||||
org.opencontainers.image.version=${{ steps.nginx-proxy_version.outputs.VERSION }}
|
|
||||||
flavor: latest=false
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v3
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Login to DockerHub
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Log in to GitHub Container Registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Retrieve docker-gen version
|
|
||||||
id: docker-gen_version
|
|
||||||
run: sed -n -e 's;^FROM nginxproxy/docker-gen:\([0-9.]*\).*;VERSION=\1;p' Dockerfile >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
- name: Build and push the Alpine based image
|
|
||||||
id: docker_build_alpine
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: Dockerfile.alpine
|
|
||||||
build-args: |
|
|
||||||
NGINX_PROXY_VERSION=${{ steps.nginx-proxy_version.outputs.VERSION }}
|
|
||||||
DOCKER_GEN_VERSION=${{ steps.docker-gen_version.outputs.VERSION }}
|
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.docker_meta_alpine.outputs.tags }}
|
|
||||||
labels: ${{ steps.docker_meta_alpine.outputs.labels }}
|
|
||||||
|
|
||||||
- name: Images digests
|
|
||||||
run: echo ${{ steps.docker_build_alpine.outputs.digest }}
|
|
||||||
|
2
Makefile
2
Makefile
@ -6,7 +6,7 @@ build-webserver:
|
|||||||
docker build --pull -t web test/requirements/web
|
docker build --pull -t web test/requirements/web
|
||||||
|
|
||||||
build-nginx-proxy-test-debian:
|
build-nginx-proxy-test-debian:
|
||||||
docker build --pull --build-arg NGINX_PROXY_VERSION="test" -t nginxproxy/nginx-proxy:test .
|
docker build --pull --build-arg NGINX_PROXY_VERSION="test" -f Dockerfile.debian -t nginxproxy/nginx-proxy:test .
|
||||||
|
|
||||||
build-nginx-proxy-test-alpine:
|
build-nginx-proxy-test-alpine:
|
||||||
docker build --pull --build-arg NGINX_PROXY_VERSION="test" -f Dockerfile.alpine -t nginxproxy/nginx-proxy:test .
|
docker build --pull --build-arg NGINX_PROXY_VERSION="test" -f Dockerfile.alpine -t nginxproxy/nginx-proxy:test .
|
||||||
|
Loading…
x
Reference in New Issue
Block a user