From e54bab2976fd2b5fb94ccee36d7b1427f92fd97b Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Sat, 26 Dec 2020 12:11:31 +0100 Subject: [PATCH] Adding debian buster and node v14 support --- .github/workflows/build.yml | 77 ++++++++++++++++--- .travis.yml | 2 +- docker/alpine/Dockerfile.build | 4 +- docker/debian-buster/Dockerfile.build | 39 ++++++++++ docker/debian-stretch/Dockerfile.build | 4 +- .../debian-stretch/selfcontained/Dockerfile | 4 +- 6 files changed, 111 insertions(+), 19 deletions(-) create mode 100644 docker/debian-buster/Dockerfile.build diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1b496336..e4033d6f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: - node-version: [10.x, 12.x, 13.x] + node-version: [12.x, 13.x, 14.x] services: mariadb: @@ -92,8 +92,8 @@ jobs: - uses: actions/download-artifact@v2 with: - name: pigallery2-release - path: pigallery2-release + name: pigallery2-release + path: pigallery2-release - name: Set up QEMU uses: docker/setup-qemu-action@v1 @@ -102,10 +102,10 @@ jobs: uses: docker/setup-buildx-action@v1 - name: Login to DockerHub - uses: docker/login-action@v1 + uses: docker/login-action@v1 with: username: ${{ secrets.REGISTRY_USERNAME }} - password: ${{ secrets.REGISTRY_PASSWORD }} + password: ${{ secrets.REGISTRY_PASSWORD }} - name: Build and push alpine nightly if: startsWith(steps.vars.outputs.type , 'head') @@ -115,7 +115,7 @@ jobs: file: docker/alpine/Dockerfile.build platforms: linux/amd64,linux/arm64,linux/arm/v7 push: true - tags: bpatrik/pigallery2:nightly-alpine + tags: bpatrik/pigallery2:nightly-alpine - name: Build and push alpine release if: startsWith(steps.vars.outputs.type , 'tag') @@ -145,8 +145,8 @@ jobs: - uses: actions/download-artifact@v2 with: - name: pigallery2-release - path: pigallery2-release + name: pigallery2-release + path: pigallery2-release - name: Set up QEMU uses: docker/setup-qemu-action@v1 @@ -155,12 +155,12 @@ jobs: uses: docker/setup-buildx-action@v1 - name: Login to DockerHub - uses: docker/login-action@v1 + uses: docker/login-action@v1 with: username: ${{ secrets.REGISTRY_USERNAME }} - password: ${{ secrets.REGISTRY_PASSWORD }} + password: ${{ secrets.REGISTRY_PASSWORD }} - - name: Build and push debian stretch nightly + name: Build and push debian stretch nightly if: startsWith(steps.vars.outputs.type , 'head') uses: docker/build-push-action@v2 with: @@ -168,7 +168,7 @@ jobs: file: docker/debian-stretch/Dockerfile.build platforms: linux/amd64,linux/arm64,linux/arm/v7 push: true - tags: bpatrik/pigallery2:nightly-stretch + tags: bpatrik/pigallery2:nightly-stretch - name: Build and push debian stretch release if: startsWith(steps.vars.outputs.type , 'tag') @@ -182,5 +182,58 @@ jobs: push: true tags: | bpatrik/pigallery2:nightly-stretch + bpatrik/pigallery2:$RELEASE_VERSION-stretch + bpatrik/pigallery2:latest-stretch + build-buster: + runs-on: [ubuntu-latest] + needs: [create-release] + 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 and push debian buster nightly + if: startsWith(steps.vars.outputs.type , 'head') + uses: docker/build-push-action@v2 + with: + context: . + file: docker/debian-stretch/Dockerfile.build + platforms: linux/amd64,linux/arm64,linux/arm/v7 + push: true + tags: bpatrik/pigallery2:nightly-buster + - + name: Build and push debian buster release + if: startsWith(steps.vars.outputs.type , 'tag') + env: + RELEASE_VERSION: ${{ steps.vars.outputs.tag }} + uses: docker/build-push-action@v2 + with: + context: . + file: docker/debian-buster/Dockerfile.build + platforms: linux/amd64,linux/arm64,linux/arm/v7 + push: true + tags: | + bpatrik/pigallery2:nightly-buster bpatrik/pigallery2:$RELEASE_VERSION bpatrik/pigallery2:latest diff --git a/.travis.yml b/.travis.yml index 59e039b3..220c8032 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,9 @@ dist: xenial language: node_js node_js: - - '10' - '12' - '13' + - '14' env: - PORT=35000 MYSQL_HOST='localhost' MYSQL_PASSWORD='' MYSQL_USERNAME='root' MYSQL_DATABASE='pigallery2_test' services: diff --git a/docker/alpine/Dockerfile.build b/docker/alpine/Dockerfile.build index 58f0fc3e..7d65778d 100644 --- a/docker/alpine/Dockerfile.build +++ b/docker/alpine/Dockerfile.build @@ -1,6 +1,6 @@ #-----------------BUILDER----------------- #----------------------------------------- -FROM node:12-alpine3.11 AS builder +FROM node:14-alpine3.11 AS builder RUN apk add --update-cache --repository https://alpine.global.ssl.fastly.net/alpine/v3.11/community/ \ python build-base sqlite-dev sqlite-libs vips-dev fftw-dev gcc g++ make libc6-compat COPY pigallery2-release /app @@ -14,7 +14,7 @@ RUN mkdir -p /app/data/config && \ #-----------------MAIN-------------------- #----------------------------------------- -FROM node:12-alpine3.11 AS main +FROM node:14-alpine3.11 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-buster/Dockerfile.build b/docker/debian-buster/Dockerfile.build new file mode 100644 index 00000000..f9a6cbc2 --- /dev/null +++ b/docker/debian-buster/Dockerfile.build @@ -0,0 +1,39 @@ +#-----------------BUILDER----------------- +#----------------------------------------- +FROM node:14-buster AS builder +COPY pigallery2-release /app +WORKDIR /app +RUN npm install --unsafe-perm +RUN mkdir -p /app/data/config && \ + mkdir -p /app/data/db && \ + mkdir -p /app/data/images && \ + mkdir -p /app/data/tmp + + +#-----------------MAIN-------------------- +#----------------------------------------- +FROM node:14-buster-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) + default-Server-Database-dbFolder=/app/data/db \ + default-Server-Media-folder=/app/data/images \ + default-Server-Media-tempFolder=/app/data/tmp \ + # flagging dockerized environemnt + PI_DOCKER=true + +EXPOSE 80 +RUN apt-get update \ + && apt-get install -y --no-install-recommends ca-certificates wget ffmpeg \ + && apt-get clean -q -y \ + && rm -rf /var/lib/apt/lists/* +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 \ + CMD wget --quiet --tries=1 --no-check-certificate --spider \ + http://localhost:80/heartbeat || exit 1 + +# after a extensive job (like video converting), pigallery calls gc, to clean up everthing as fast as possible +# Exec form entrypoint is need otherwise (using shell form) ENV variables are not properly passed down to the app +ENTRYPOINT ["node", "./src/backend/index", "--expose-gc", "--config-path=/app/data/config/config.json"] + diff --git a/docker/debian-stretch/Dockerfile.build b/docker/debian-stretch/Dockerfile.build index a765a585..0f8a403a 100644 --- a/docker/debian-stretch/Dockerfile.build +++ b/docker/debian-stretch/Dockerfile.build @@ -1,6 +1,6 @@ #-----------------BUILDER----------------- #----------------------------------------- -FROM node:12-stretch AS builder +FROM node:14-stretch 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:12-stretch-slim AS main +FROM node:14-stretch-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-stretch/selfcontained/Dockerfile index 46da3b28..f350eaa9 100644 --- a/docker/debian-stretch/selfcontained/Dockerfile +++ b/docker/debian-stretch/selfcontained/Dockerfile @@ -1,6 +1,6 @@ #-----------------BUILDER----------------- #----------------------------------------- -FROM node:12-stretch AS builder +FROM node:14-buster AS builder # LABEL maintainer="Patrik J. Braun" # copying only package{-lock}.json to make node_modules cachable RUN git clone https://github.com/bpatrik/pigallery2.git /build @@ -16,7 +16,7 @@ RUN npm install --unsafe-perm \ #-----------------MAIN-------------------- #----------------------------------------- -FROM node:12-stretch-slim AS main +FROM node:14-buster-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)