1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

Merge pull request #455 from bpatrik/test/sharp

Test/sharp
This commit is contained in:
Patrik J. Braun 2022-03-11 13:30:14 +01:00 committed by GitHub
commit 26de21c66b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 27 additions and 74 deletions

View File

@ -87,12 +87,12 @@ jobs:
with: with:
name: pigallery2-release name: pigallery2-release
path: release path: release
build-docker-amd64arm64: build-dockerx:
runs-on: [ ubuntu-latest ] runs-on: [ ubuntu-latest ]
needs: [ create-release ] needs: [ create-release ]
strategy: strategy:
matrix: matrix:
container: [ alpine, debian-stretch ] container: [alpine, debian-buster, debian-bullseye ]
steps: steps:
- name: Set tag - name: Set tag
@ -113,96 +113,44 @@ jobs:
with: with:
username: ${{ secrets.REGISTRY_USERNAME }} username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }} password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Test build on Pull request and test branches - name: Build docker
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 uses: docker/build-push-action@v2
with: with:
context: . context: .
file: docker/${{ matrix.container }}/Dockerfile.build file: docker/${{ matrix.container }}/Dockerfile.build
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64,linux/arm/v7
- name: Build experimental - name: Push experimental
if: ${{ github.ref == 'refs/heads/experimental' }} if: ${{ github.ref == 'refs/heads/experimental' }}
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
with: with:
context: . context: .
file: docker/${{ matrix.container }}/Dockerfile.build file: docker/${{ matrix.container }}/Dockerfile.build
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true push: true
tags: bpatrik/pigallery2:experimental-${{ matrix.container }} 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' }} if: ${{ startsWith(steps.vars.outputs.type , 'head') && !github.event.issue.pull_request && github.ref == 'refs/heads/master' }}
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
with: with:
context: . context: .
file: docker/${{ matrix.container }}/Dockerfile.build file: docker/${{ matrix.container }}/Dockerfile.build
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true push: true
tags: bpatrik/pigallery2:nightly-${{ matrix.container }} 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 }} if: ${{ startsWith(steps.vars.outputs.type , 'tag') && !github.event.issue.pull_request && matrix.container !== 'debian-buster'}}
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
with: with:
context: . context: .
file: docker/${{ matrix.container }}/Dockerfile.build file: docker/${{ matrix.container }}/Dockerfile.build
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true push: true
tags: | tags: |
bpatrik/pigallery2:nightly-${{ matrix.container }} bpatrik/pigallery2:nightly-${{ matrix.container }}
bpatrik/pigallery2:${{ steps.vars.outputs.tag}}-${{matrix.container}} bpatrik/pigallery2:${{ steps.vars.outputs.tag }}-${{ matrix.container }}
bpatrik/pigallery2:latest-${{matrix.container}} bpatrik/pigallery2:latest-${{ matrix.container }}
build-docker-all-platforms: - name: Push latest on new Tag
runs-on: [ ubuntu-latest ] if: ${{ startsWith(steps.vars.outputs.type , 'tag') && !github.event.issue.pull_request && matrix.container === 'debian-buster'}}
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
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,linux/arm/v7
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,linux/arm/v7
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 uses: docker/build-push-action@v2
with: with:
context: . context: .

View File

@ -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/). 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: available tags:
- `v*` (stable): built from the a release with the same version name. - `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. - `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`) **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 `<path to your db file folder>/sqlite.db` line if you don't
## Build the Docker image on your own ## 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)

View File

@ -2,7 +2,10 @@
#----------------------------------------- #-----------------------------------------
FROM node:14-alpine3.15 AS builder FROM node:14-alpine3.15 AS builder
RUN apk add --update-cache --repository https://alpine.global.ssl.fastly.net/alpine/v3.15/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 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 COPY pigallery2-release /app
WORKDIR /app WORKDIR /app
RUN npm install --unsafe-perm RUN npm install --unsafe-perm
@ -25,8 +28,10 @@ ENV NODE_ENV=production \
PI_DOCKER=true PI_DOCKER=true
EXPOSE 80 EXPOSE 80
RUN apk add --update-cache --repository https://alpine.global.ssl.fastly.net/alpine/v3.15/community/ \ RUN apk add --update-cache --repository https://alpine.global.ssl.fastly.net/alpine/v3.15/community/ ffmpeg
vips 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 COPY --from=builder /app /app
VOLUME ["/app/data/config", "/app/data/db", "/app/data/images", "/app/data/tmp"] VOLUME ["/app/data/config", "/app/data/db", "/app/data/images", "/app/data/tmp"]
HEALTHCHECK --interval=40s --timeout=30s --retries=3 --start-period=60s \ HEALTHCHECK --interval=40s --timeout=30s --retries=3 --start-period=60s \

View File

@ -1,6 +1,6 @@
#-----------------BUILDER----------------- #-----------------BUILDER-----------------
#----------------------------------------- #-----------------------------------------
FROM node:14-buster AS builder FROM node:14-bullseye AS builder
COPY pigallery2-release /app COPY pigallery2-release /app
WORKDIR /app WORKDIR /app
RUN npm install --unsafe-perm RUN npm install --unsafe-perm
@ -12,7 +12,7 @@ RUN mkdir -p /app/data/config && \
#-----------------MAIN-------------------- #-----------------MAIN--------------------
#----------------------------------------- #-----------------------------------------
FROM node:14-buster-slim AS main FROM node:14-bullseye-slim AS main
WORKDIR /app WORKDIR /app
ENV NODE_ENV=production \ ENV NODE_ENV=production \
# overrides only the default value of the settings (the actualy value can be overwritten through config.json) # overrides only the default value of the settings (the actualy value can be overwritten through config.json)