mirror of
https://github.com/invoiceninja/dockerfiles.git
synced 2025-12-31 19:47:25 +01:00
Add caching to build (#369)
* Rename publish workflow * Add caching to v5 * Updated cache buster
This commit is contained in:
57
.github/workflows/build-image-v5.yml
vendored
Normal file
57
.github/workflows/build-image-v5.yml
vendored
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
name: Build Container Image
|
||||||
|
|
||||||
|
# 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:
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- "alpine/5/**"
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- "alpine/5/**"
|
||||||
|
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 }}-buildx-5-${{ hashFiles('alpine/5/cache_buster') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-buildx-5-${{ hashFiles('alpine/5/cache_buster') }}
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
id: docker_build
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
builder: ${{ steps.buildx.outputs.name }}
|
||||||
|
context: ./alpine/5/
|
||||||
|
build-args: INVOICENINJA_VERSION=5-stable
|
||||||
|
target: prod
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
tags: invoiceninja/invoiceninja: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
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
name: Publish Releases to Hub
|
name: Publish Container Image
|
||||||
|
|
||||||
# When its time to do a release do a full cross platform build for all supported
|
# 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.
|
# architectures and push all of them to Docker Hub.
|
||||||
@@ -44,13 +44,13 @@ jobs:
|
|||||||
id: buildx
|
id: buildx
|
||||||
uses: docker/setup-buildx-action@v1
|
uses: docker/setup-buildx-action@v1
|
||||||
|
|
||||||
# - name: Cache Docker layers
|
- name: Cache Docker layers
|
||||||
# uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
# with:
|
with:
|
||||||
# path: /tmp/.buildx-cache
|
path: /tmp/.buildx-cache
|
||||||
# key: ${{ runner.os }}-buildx-${{ github.sha }}
|
key: ${{ runner.os }}-buildx-${{ steps.prep.outputs.major }}-${{ hashFiles('alpine/${{ steps.prep.outputs.major }}/**') }}
|
||||||
# restore-keys: |
|
restore-keys: |
|
||||||
# ${{ runner.os }}-buildx-
|
${{ runner.os }}-buildx-${{ steps.prep.outputs.major }}-${{ hashFiles('alpine/${{ steps.prep.outputs.major }}/**') }}
|
||||||
|
|
||||||
- name: Login to DockerHub
|
- name: Login to DockerHub
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
@@ -70,8 +70,8 @@ jobs:
|
|||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
tags: ${{ steps.prep.outputs.tags }}
|
tags: ${{ steps.prep.outputs.tags }}
|
||||||
cache-from: invoiceninja/invoiceninja:${{ steps.prep.outputs.major }}
|
cache-from: type=local,src=/tmp/.buildx-cache
|
||||||
cache-to: type=inline
|
cache-to: type=local,dest=/tmp/.buildx-cache
|
||||||
|
|
||||||
- name: Image digest
|
- name: Image digest
|
||||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||||
@@ -2,6 +2,8 @@
|
|||||||
[](https://hub.docker.com/r/invoiceninja/invoiceninja)
|
[](https://hub.docker.com/r/invoiceninja/invoiceninja)
|
||||||
[](https://hub.docker.com/r/invoiceninja/invoiceninja)
|
[](https://hub.docker.com/r/invoiceninja/invoiceninja)
|
||||||
[](https://artifacthub.io/packages/search?repo=invoiceninja)
|
[](https://artifacthub.io/packages/search?repo=invoiceninja)
|
||||||
|
[](https://github.com/invoiceninja/dockerfiles/actions/workflows/publish-image.yaml) [](https://github.com/invoiceninja/dockerfiles/actions/workflows/build-image-v5.yaml)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Docker for [Invoice Ninja](https://www.invoiceninja.com/)
|
# Docker for [Invoice Ninja](https://www.invoiceninja.com/)
|
||||||
|
|||||||
1
alpine/5/cache_buster
Normal file
1
alpine/5/cache_buster
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Fri Jul 2 7:33:22 +00 2021
|
||||||
Reference in New Issue
Block a user