From 89aebfd0143d086e2a90654feb11863c7c1b0729 Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Thu, 10 Mar 2022 20:35:32 +0100 Subject: [PATCH 1/4] testing if sharp can build on alpine all platforms --- .github/workflows/build.yml | 22 ++++++++++------------ docker/alpine/Dockerfile.build | 11 ++++++++--- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 40cd36fe..a7a2b793 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -92,7 +92,7 @@ jobs: needs: [ create-release ] strategy: matrix: - container: [ alpine, debian-stretch ] + container: [ debian-stretch ] steps: - name: Set tag @@ -113,14 +113,13 @@ jobs: with: username: ${{ secrets.REGISTRY_USERNAME }} password: ${{ secrets.REGISTRY_PASSWORD }} - - name: Test build on Pull request and test branches - if: ${{ startsWith(steps.vars.outputs.type , 'head') && ((github.event.issue.pull_request && github.ref == 'refs/heads/master') || github.ref != 'refs/heads/master') }} + - name: Build docker uses: docker/build-push-action@v2 with: context: . file: docker/${{ matrix.container }}/Dockerfile.build platforms: linux/amd64,linux/arm64 - - name: Build experimental + - name: Push experimental if: ${{ github.ref == 'refs/heads/experimental' }} uses: docker/build-push-action@v2 with: @@ -129,7 +128,7 @@ jobs: platforms: linux/amd64,linux/arm64 push: true tags: bpatrik/pigallery2:experimental-${{ matrix.container }} - - name: Build and push nightly on new master commit + - name: Push nightly on new master commit if: ${{ startsWith(steps.vars.outputs.type , 'head') && !github.event.issue.pull_request && github.ref == 'refs/heads/master' }} uses: docker/build-push-action@v2 with: @@ -138,7 +137,7 @@ jobs: platforms: linux/amd64,linux/arm64 push: true tags: bpatrik/pigallery2:nightly-${{ matrix.container }} - - name: Build and push release on new Tag + - name: Push release on new Tag if: ${{ startsWith(steps.vars.outputs.type , 'tag') && !github.event.issue.pull_request }} uses: docker/build-push-action@v2 with: @@ -155,7 +154,7 @@ jobs: needs: [ create-release ] strategy: matrix: - container: [ debian-buster ] + container: [alpine, debian-buster ] steps: - name: Set tag @@ -176,14 +175,13 @@ jobs: with: username: ${{ secrets.REGISTRY_USERNAME }} password: ${{ secrets.REGISTRY_PASSWORD }} - - name: Test build on Pull request and test branches - if: ${{ startsWith(steps.vars.outputs.type , 'head') && ((github.event.issue.pull_request && github.ref == 'refs/heads/master') || github.ref != 'refs/heads/master') }} + - name: Build docker uses: docker/build-push-action@v2 with: context: . file: docker/${{ matrix.container }}/Dockerfile.build platforms: linux/amd64,linux/arm64,linux/arm/v7 - - name: Build experimental + - name: Push experimental if: ${{ github.ref == 'refs/heads/experimental' }} uses: docker/build-push-action@v2 with: @@ -192,7 +190,7 @@ jobs: platforms: linux/amd64,linux/arm64,linux/arm/v7 push: true tags: bpatrik/pigallery2:experimental-${{ matrix.container }} - - name: Build and push nightly on new master commit + - name: Push nightly on new master commit if: ${{ startsWith(steps.vars.outputs.type , 'head') && !github.event.issue.pull_request && github.ref == 'refs/heads/master' }} uses: docker/build-push-action@v2 with: @@ -201,7 +199,7 @@ jobs: platforms: linux/amd64,linux/arm64,linux/arm/v7 push: true tags: bpatrik/pigallery2:nightly-${{ matrix.container }} - - name: Build and push release on new Tag + - name: Push release on new Tag if: ${{ startsWith(steps.vars.outputs.type , 'tag') && !github.event.issue.pull_request }} uses: docker/build-push-action@v2 with: diff --git a/docker/alpine/Dockerfile.build b/docker/alpine/Dockerfile.build index 6f2ee2f6..0d395390 100644 --- a/docker/alpine/Dockerfile.build +++ b/docker/alpine/Dockerfile.build @@ -2,7 +2,10 @@ #----------------------------------------- FROM node:14-alpine3.15 AS builder RUN apk add --update-cache --repository https://alpine.global.ssl.fastly.net/alpine/v3.15/community/ \ - python3 build-base sqlite-dev sqlite-libs vips-dev vips fftw-dev gcc g++ make libc6-compat && ln -snf /usr/bin/python3 /usr/bin/python + python3 build-base sqlite-dev sqlite-libs fftw-dev gcc g++ make libc6-compat && ln -snf /usr/bin/python3 /usr/bin/python \ + +RUN apk add --update-cache --repository https://alpine.global.ssl.fastly.net/alpine/edge/community/ vips-dev>8.12.2-r3 vips>8.12.2-r3 + COPY pigallery2-release /app WORKDIR /app RUN npm install --unsafe-perm @@ -25,8 +28,10 @@ ENV NODE_ENV=production \ PI_DOCKER=true EXPOSE 80 -RUN apk add --update-cache --repository https://alpine.global.ssl.fastly.net/alpine/v3.15/community/ \ - vips ffmpeg +RUN apk add --update-cache --repository https://alpine.global.ssl.fastly.net/alpine/v3.15/community/ ffmpeg +RUN apk add --update-cache --repository https://alpine.global.ssl.fastly.net/alpine/edge/community/ vips>8.12.2-r3 + + COPY --from=builder /app /app VOLUME ["/app/data/config", "/app/data/db", "/app/data/images", "/app/data/tmp"] HEALTHCHECK --interval=40s --timeout=30s --retries=3 --start-period=60s \ From d0f2344ce7ccc2d0911039169aeda6a81687ce18 Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Fri, 11 Mar 2022 10:19:36 +0100 Subject: [PATCH 2/4] remove backslash --- docker/alpine/Dockerfile.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/alpine/Dockerfile.build b/docker/alpine/Dockerfile.build index 0d395390..3413a11a 100644 --- a/docker/alpine/Dockerfile.build +++ b/docker/alpine/Dockerfile.build @@ -2,7 +2,7 @@ #----------------------------------------- FROM node:14-alpine3.15 AS builder RUN apk add --update-cache --repository https://alpine.global.ssl.fastly.net/alpine/v3.15/community/ \ - python3 build-base sqlite-dev sqlite-libs fftw-dev gcc g++ make libc6-compat && ln -snf /usr/bin/python3 /usr/bin/python \ + python3 build-base sqlite-dev sqlite-libs fftw-dev gcc g++ make libc6-compat && ln -snf /usr/bin/python3 /usr/bin/python RUN apk add --update-cache --repository https://alpine.global.ssl.fastly.net/alpine/edge/community/ vips-dev>8.12.2-r3 vips>8.12.2-r3 From 3829c230364cecde98176c3aad07c08e1c146e53 Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Fri, 11 Mar 2022 13:21:29 +0100 Subject: [PATCH 3/4] replacing stretch with bulsseye --- .github/workflows/build.yml | 78 ++++--------------- docker/README.md | 4 +- .../Dockerfile.build | 0 docker/debian-buster/Dockerfile.build | 4 +- .../selfcontained/Dockerfile | 0 5 files changed, 18 insertions(+), 68 deletions(-) rename docker/{debian-stretch => debian-bullseye}/Dockerfile.build (100%) rename docker/{debian-stretch => debian-buster}/selfcontained/Dockerfile (100%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a7a2b793..f5282673 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -87,74 +87,12 @@ jobs: with: name: pigallery2-release path: release - build-docker-amd64arm64: + build-dockerx: runs-on: [ ubuntu-latest ] needs: [ create-release ] strategy: matrix: - container: [ debian-stretch ] - - steps: - - name: Set tag - id: vars - run: echo ::set-output name=tag::$(echo ${GITHUB_REF:10}) && echo ::set-output name=type::$(echo ${GITHUB_REF:5}) - - name: Checkout - uses: actions/checkout@v2 - - uses: actions/download-artifact@v2 - with: - name: pigallery2-release - path: pigallery2-release - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - name: Login to DockerHub - uses: docker/login-action@v1 - with: - username: ${{ secrets.REGISTRY_USERNAME }} - password: ${{ secrets.REGISTRY_PASSWORD }} - - name: Build docker - uses: docker/build-push-action@v2 - with: - context: . - file: docker/${{ matrix.container }}/Dockerfile.build - platforms: linux/amd64,linux/arm64 - - name: Push experimental - if: ${{ github.ref == 'refs/heads/experimental' }} - uses: docker/build-push-action@v2 - with: - context: . - file: docker/${{ matrix.container }}/Dockerfile.build - platforms: linux/amd64,linux/arm64 - push: true - tags: bpatrik/pigallery2:experimental-${{ matrix.container }} - - name: Push nightly on new master commit - if: ${{ startsWith(steps.vars.outputs.type , 'head') && !github.event.issue.pull_request && github.ref == 'refs/heads/master' }} - uses: docker/build-push-action@v2 - with: - context: . - file: docker/${{ matrix.container }}/Dockerfile.build - platforms: linux/amd64,linux/arm64 - push: true - tags: bpatrik/pigallery2:nightly-${{ matrix.container }} - - name: Push release on new Tag - if: ${{ startsWith(steps.vars.outputs.type , 'tag') && !github.event.issue.pull_request }} - uses: docker/build-push-action@v2 - with: - context: . - file: docker/${{ matrix.container }}/Dockerfile.build - platforms: linux/amd64,linux/arm64 - push: true - tags: | - bpatrik/pigallery2:nightly-${{ matrix.container }} - bpatrik/pigallery2:${{ steps.vars.outputs.tag}}-${{matrix.container}} - bpatrik/pigallery2:latest-${{matrix.container}} - build-docker-all-platforms: - runs-on: [ ubuntu-latest ] - needs: [ create-release ] - strategy: - matrix: - container: [alpine, debian-buster ] + container: [alpine, debian-buster, debian-bullseye ] steps: - name: Set tag @@ -211,3 +149,15 @@ jobs: bpatrik/pigallery2:nightly-${{ matrix.container }} bpatrik/pigallery2:${{ steps.vars.outputs.tag }} bpatrik/pigallery2:latest + - name: Push release on new Tag + if: ${{ startsWith(steps.vars.outputs.type , 'tag') && !github.event.issue.pull_request }} + uses: docker/build-push-action@v2 + with: + context: . + file: docker/${{ matrix.container }}/Dockerfile.build + platforms: linux/amd64,linux/arm64,linux/arm/v7 + push: true + tags: | + bpatrik/pigallery2:nightly-${{ matrix.container }} + bpatrik/pigallery2:${{ steps.vars.outputs.tag }} + bpatrik/pigallery2:latest diff --git a/docker/README.md b/docker/README.md index bedd4872..418c71c5 100644 --- a/docker/README.md +++ b/docker/README.md @@ -5,7 +5,7 @@ You can use [docker](https://docs.docker.com/install/) to run PiGallery2. See all available docker tags [here](https://hub.docker.com/r/bpatrik/pigallery2/tags/). available tags: - `v*` (stable): built from the a release with the same version name. - - `latest` (stable): same as the latest `v*`, built with debian stretch + - `latest` (stable): same as the latest `v*`, built with debian buster - `nightly` : built from the current state of `master`. This might break from time to time. **Note**: Some changes may require database reset or config changes, see [#317](https://github.com/bpatrik/pigallery2/issues/317) (If you want to reduce the frequency of those, use stable builds (`latest`) @@ -120,6 +120,6 @@ You do not need the `/sqlite.db` line if you don't ## Build the Docker image on your own -You can clone the repository and build the image, or you can just use the 'self-contained' Dockerfile: [debian-stretch/selfcontained/Dockerfile](debian-stretch/selfcontained/Dockerfile) +You can clone the repository and build the image, or you can just use the 'self-contained' Dockerfile: [debian-buster/selfcontained/Dockerfile](debian-buster/selfcontained/Dockerfile) diff --git a/docker/debian-stretch/Dockerfile.build b/docker/debian-bullseye/Dockerfile.build similarity index 100% rename from docker/debian-stretch/Dockerfile.build rename to docker/debian-bullseye/Dockerfile.build diff --git a/docker/debian-buster/Dockerfile.build b/docker/debian-buster/Dockerfile.build index f9a6cbc2..852cfef1 100644 --- a/docker/debian-buster/Dockerfile.build +++ b/docker/debian-buster/Dockerfile.build @@ -1,6 +1,6 @@ #-----------------BUILDER----------------- #----------------------------------------- -FROM node:14-buster AS builder +FROM node:14-bullseye AS builder COPY pigallery2-release /app WORKDIR /app RUN npm install --unsafe-perm @@ -12,7 +12,7 @@ RUN mkdir -p /app/data/config && \ #-----------------MAIN-------------------- #----------------------------------------- -FROM node:14-buster-slim AS main +FROM node:14-bullseye-slim AS main WORKDIR /app ENV NODE_ENV=production \ # overrides only the default value of the settings (the actualy value can be overwritten through config.json) diff --git a/docker/debian-stretch/selfcontained/Dockerfile b/docker/debian-buster/selfcontained/Dockerfile similarity index 100% rename from docker/debian-stretch/selfcontained/Dockerfile rename to docker/debian-buster/selfcontained/Dockerfile From f0fe9a3fa86ac12da9baddabd179db05ff820942 Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Fri, 11 Mar 2022 13:30:04 +0100 Subject: [PATCH 4/4] updating build file --- .github/workflows/build.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f5282673..29fba6f3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -138,19 +138,19 @@ jobs: push: true tags: bpatrik/pigallery2:nightly-${{ matrix.container }} - name: Push release on new Tag - if: ${{ startsWith(steps.vars.outputs.type , 'tag') && !github.event.issue.pull_request }} - uses: docker/build-push-action@v2 - with: - context: . - file: docker/${{ matrix.container }}/Dockerfile.build - platforms: linux/amd64,linux/arm64,linux/arm/v7 - push: true - tags: | - bpatrik/pigallery2:nightly-${{ matrix.container }} - bpatrik/pigallery2:${{ steps.vars.outputs.tag }} - bpatrik/pigallery2:latest - - name: Push release on new Tag - if: ${{ startsWith(steps.vars.outputs.type , 'tag') && !github.event.issue.pull_request }} + if: ${{ startsWith(steps.vars.outputs.type , 'tag') && !github.event.issue.pull_request && matrix.container !== 'debian-buster'}} + uses: docker/build-push-action@v2 + with: + context: . + file: docker/${{ matrix.container }}/Dockerfile.build + platforms: linux/amd64,linux/arm64,linux/arm/v7 + push: true + tags: | + bpatrik/pigallery2:nightly-${{ matrix.container }} + bpatrik/pigallery2:${{ steps.vars.outputs.tag }}-${{ matrix.container }} + bpatrik/pigallery2:latest-${{ matrix.container }} + - name: Push latest on new Tag + if: ${{ startsWith(steps.vars.outputs.type , 'tag') && !github.event.issue.pull_request && matrix.container === 'debian-buster'}} uses: docker/build-push-action@v2 with: context: .