diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8eab9fce..40cd36fe 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -87,48 +87,103 @@ jobs: with: name: pigallery2-release path: release - build-docker: - runs-on: [ubuntu-latest] - needs: [create-release] + build-docker-amd64arm64: + runs-on: [ ubuntu-latest ] + needs: [ create-release ] strategy: matrix: - container: [alpine, debian-stretch, debian-buster] + container: [ alpine, debian-stretch ] steps: - - - name: Set tag + - 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 + - name: Checkout uses: actions/checkout@v2 - - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v2 with: name: pigallery2-release path: pigallery2-release - - - name: Set up QEMU + - name: Set up QEMU uses: docker/setup-qemu-action@v1 - - - name: Set up Docker Buildx + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - - - name: Login to DockerHub + - name: Login to DockerHub uses: docker/login-action@v1 with: username: ${{ secrets.REGISTRY_USERNAME }} password: ${{ secrets.REGISTRY_PASSWORD }} - - - name: Test build on Pull request and test branches + - 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') }} + uses: docker/build-push-action@v2 + with: + context: . + file: docker/${{ matrix.container }}/Dockerfile.build + platforms: linux/amd64,linux/arm64 + - name: Build 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: Build and 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: Build and 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: [ debian-buster ] + + 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: 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') }} 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: Build experimental if: ${{ github.ref == 'refs/heads/experimental' }} uses: docker/build-push-action@v2 with: @@ -137,8 +192,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: Build and 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: @@ -147,8 +201,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: Build and push release on new Tag if: ${{ startsWith(steps.vars.outputs.type , 'tag') && !github.event.issue.pull_request }} uses: docker/build-push-action@v2 with: @@ -158,5 +211,5 @@ jobs: push: true tags: | bpatrik/pigallery2:nightly-${{ matrix.container }} - bpatrik/pigallery2:${{ matrix.container == 'debian-buster' && steps.vars.outputs.tag || format('{0}-{1}',steps.vars.outputs.tag,matrix.container) }} - bpatrik/pigallery2:${{ matrix.container == 'debian-buster' && 'latest' || format('latest-{0}',matrix.container) }} + bpatrik/pigallery2:${{ steps.vars.outputs.tag }} + bpatrik/pigallery2:latest diff --git a/docker/alpine/Dockerfile.build b/docker/alpine/Dockerfile.build index 8b19a0dd..49e11e3a 100644 --- a/docker/alpine/Dockerfile.build +++ b/docker/alpine/Dockerfile.build @@ -1,7 +1,7 @@ #-----------------BUILDER----------------- #----------------------------------------- FROM node:14-alpine3.15 AS builder -RUN apk add --update-cache --repository https://alpine.global.ssl.fastly.net/alpine/v3.13/community/ \ +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 fftw-dev gcc g++ make libc6-compat && ln -snf /usr/bin/python3 /usr/bin/python COPY pigallery2-release /app WORKDIR /app @@ -25,7 +25,7 @@ ENV NODE_ENV=production \ PI_DOCKER=true EXPOSE 80 -RUN apk add --update-cache --repository https://alpine.global.ssl.fastly.net/alpine/v3.13/community/ \ +RUN apk add --update-cache --repository https://alpine.global.ssl.fastly.net/alpine/v3.15/community/ \ vips ffmpeg COPY --from=builder /app /app VOLUME ["/app/data/config", "/app/data/db", "/app/data/images", "/app/data/tmp"]