diff --git a/.github/workflows/build-image-v5.yml b/.github/workflows/build-image-v5.yml new file mode 100644 index 0000000..da3b6b9 --- /dev/null +++ b/.github/workflows/build-image-v5.yml @@ -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 diff --git a/.github/workflows/build_push.yml b/.github/workflows/publish-image.yml similarity index 80% rename from .github/workflows/build_push.yml rename to .github/workflows/publish-image.yml index dcdd86f..11d020d 100644 --- a/.github/workflows/build_push.yml +++ b/.github/workflows/publish-image.yml @@ -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 # architectures and push all of them to Docker Hub. @@ -44,13 +44,13 @@ jobs: 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-${{ github.sha }} - # restore-keys: | - # ${{ runner.os }}-buildx- + - name: Cache Docker layers + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ steps.prep.outputs.major }}-${{ hashFiles('alpine/${{ steps.prep.outputs.major }}/**') }} + restore-keys: | + ${{ runner.os }}-buildx-${{ steps.prep.outputs.major }}-${{ hashFiles('alpine/${{ steps.prep.outputs.major }}/**') }} - name: Login to DockerHub if: github.event_name != 'pull_request' @@ -70,8 +70,8 @@ jobs: platforms: linux/amd64,linux/arm64 push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.prep.outputs.tags }} - cache-from: invoiceninja/invoiceninja:${{ steps.prep.outputs.major }} - cache-to: type=inline + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache - name: Image digest run: echo ${{ steps.docker_build.outputs.digest }} diff --git a/README.md b/README.md index d9eac97..de26d42 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ [![Docker image, latest](https://img.shields.io/docker/image-size/invoiceninja/invoiceninja/latest?label=latest)](https://hub.docker.com/r/invoiceninja/invoiceninja) [![Docker image, alpine](https://img.shields.io/docker/image-size/invoiceninja/invoiceninja/alpine?label=alpine)](https://hub.docker.com/r/invoiceninja/invoiceninja) [![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/invoiceninja)](https://artifacthub.io/packages/search?repo=invoiceninja) +[![Pusblish Image](https://github.com/invoiceninja/dockerfiles/actions/workflows/publish-image.yaml/badge.svg)](https://github.com/invoiceninja/dockerfiles/actions/workflows/publish-image.yaml) [![Cache v5 Image](https://github.com/invoiceninja/dockerfiles/actions/workflows/build-image-v5.yaml/badge.svg)](https://github.com/invoiceninja/dockerfiles/actions/workflows/build-image-v5.yaml) + # Docker for [Invoice Ninja](https://www.invoiceninja.com/) diff --git a/alpine/5/cache_buster b/alpine/5/cache_buster new file mode 100644 index 0000000..e38ef8f --- /dev/null +++ b/alpine/5/cache_buster @@ -0,0 +1 @@ +Fri Jul 2 7:33:22 +00 2021 \ No newline at end of file