mirror of
https://github.com/invoiceninja/dockerfiles.git
synced 2025-12-31 19:47:25 +01:00
Complete build pipeline to include debian image
This commit is contained in:
52
.github/workflows/build-image-debian.yaml
vendored
Normal file
52
.github/workflows/build-image-debian.yaml
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
name: Build Debian Container Image
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- "debian/**"
|
||||
push:
|
||||
paths:
|
||||
- "debian/**"
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
with:
|
||||
platforms: all
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-debian-buildx-${{ hashFiles('debian/cache_buster') }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-debian-buildx-${{ hashFiles('debian/cache_buster') }}-
|
||||
|
||||
- name: Build
|
||||
id: docker_build
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
builder: ${{ steps.buildx.outputs.name }}
|
||||
context: ./debian/
|
||||
build-args: INVOICENINJA_VERSION=5-develop
|
||||
platforms: linux/amd64,linux/arm64
|
||||
tags: invoiceninja/invoiceninja-debian:cache
|
||||
cache-from: type=local,src=/tmp/.buildx-cache
|
||||
cache-to: type=local,dest=/tmp/.buildx-cache-new
|
||||
|
||||
- name: Move cache
|
||||
run: |
|
||||
rm -rf /tmp/.buildx-cache
|
||||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
||||
24
.github/workflows/publish-image.yaml
vendored
24
.github/workflows/publish-image.yaml
vendored
@@ -1,9 +1,5 @@
|
||||
name: Publish Container Image
|
||||
name: Publish Container Images
|
||||
|
||||
# When its time to do a release do a full cross platform build for all supported
|
||||
# architectures and push all of them to Docker Hub.
|
||||
# Only trigger on semver shaped tags.
|
||||
# Ref: https://github.com/metcalfc/docker-action-examples/blob/main/.github/workflows/release.yml
|
||||
on:
|
||||
push:
|
||||
tags-ignore:
|
||||
@@ -12,6 +8,14 @@ on:
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- image: invoiceninja/invoiceninja
|
||||
context: ./alpine/5/
|
||||
- image: invoiceninja/invoiceninja-debian
|
||||
context: ./debian/
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
@@ -19,7 +23,7 @@ jobs:
|
||||
- name: Prepare
|
||||
id: prep
|
||||
run: |
|
||||
DOCKER_IMAGE=invoiceninja/invoiceninja
|
||||
DOCKER_IMAGE=${{ matrix.image }}
|
||||
VERSION=edge
|
||||
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
||||
VERSION=${GITHUB_REF#refs/tags/}
|
||||
@@ -48,9 +52,9 @@ jobs:
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-buildx-${{ steps.prep.outputs.major }}-${{ hashFiles('alpine/${{ steps.prep.outputs.major }}/cache_buster') }}-${{ github.sha }}
|
||||
key: ${{ runner.os }}-${{ matrix.image }}-buildx-${{ steps.prep.outputs.major }}-${{ hashFiles('**/cache_buster') }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-buildx-${{ steps.prep.outputs.major }}-${{ hashFiles('alpine/${{ steps.prep.outputs.major }}/cache_buster') }}-
|
||||
${{ runner.os }}-${{ matrix.image }}-buildx-${{ steps.prep.outputs.major }}-${{ hashFiles('**/cache_buster') }}-
|
||||
|
||||
- name: Login to DockerHub
|
||||
if: github.event_name != 'pull_request'
|
||||
@@ -64,7 +68,7 @@ jobs:
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
builder: ${{ steps.buildx.outputs.name }}
|
||||
context: ./alpine/${{ steps.prep.outputs.major }}/
|
||||
context: ${{ matrix.context }}
|
||||
build-args: INVOICENINJA_VERSION=${{ steps.prep.outputs.version }}
|
||||
target: prod
|
||||
platforms: linux/amd64,linux/arm64
|
||||
@@ -79,4 +83,4 @@ jobs:
|
||||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
||||
|
||||
- name: Image digest
|
||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||
Reference in New Issue
Block a user