mirror of
https://github.com/xuthus83/pigallery2.git
synced 2025-01-14 14:43:17 +08:00
refactoring Dockerfiles, adding arm32v6 support
This commit is contained in:
parent
4fa8b54d67
commit
fbdbafaa9a
2
.gitignore
vendored
2
.gitignore
vendored
@ -20,7 +20,7 @@ benchmark/**/*.js
|
|||||||
benchmark/**/*.js.map
|
benchmark/**/*.js.map
|
||||||
gulpfile.js
|
gulpfile.js
|
||||||
gulpfile.js.map
|
gulpfile.js.map
|
||||||
demo/TEMP/
|
demo/tmp/
|
||||||
config.json
|
config.json
|
||||||
users.db
|
users.db
|
||||||
sqlite.db
|
sqlite.db
|
||||||
|
21
README.md
21
README.md
@ -55,6 +55,7 @@ wget https://github.com/bpatrik/pigallery2/archive/master.zip
|
|||||||
unzip master.zip
|
unzip master.zip
|
||||||
cd pigallery2-master # enter the unzipped directory
|
cd pigallery2-master # enter the unzipped directory
|
||||||
npm install
|
npm install
|
||||||
|
npm build
|
||||||
```
|
```
|
||||||
**Note**: if you run `npm run create-release`, it creates a clean, minified, production ready version from the app in the `release` folder, that is ready to deploy.
|
**Note**: if you run `npm run create-release`, it creates a clean, minified, production ready version from the app in the `release` folder, that is ready to deploy.
|
||||||
|
|
||||||
@ -69,24 +70,8 @@ The app has a nice UI for settings, you may use that too.
|
|||||||
Default user: `admin` pass: `admin`
|
Default user: `admin` pass: `admin`
|
||||||
|
|
||||||
### 1.2 Run with Docker
|
### 1.2 Run with Docker
|
||||||
If you have `docker` and don't want to install all the dependencies, use this:
|
If you have `docker` and don't want to install all the dependencies, you can use one of our docker build.
|
||||||
```bash
|
For configuration read more [here](docker/README.md) or check all builds: https://hub.docker.com/r/bpatrik/pigallery2/tags/
|
||||||
docker run \
|
|
||||||
-p 80:80 \
|
|
||||||
-e NODE_ENV=production \
|
|
||||||
-v <path to your config file folder>/config.json:/pigallery2-release/config.json \
|
|
||||||
-v <path to your db file folder>/sqlite.db:/pigallery2-release/sqlite.db \
|
|
||||||
-v <path to your images folder>:/pigallery2-release/demo/images \
|
|
||||||
-v <path to your temp folder>:/pigallery2-release/demo/TEMP \
|
|
||||||
bpatrik/pigallery2:1.7.0-stretch
|
|
||||||
```
|
|
||||||
Make sure that a file at `<path to your config file folder>/config.json` and `sqlite.db` files exists before running it.
|
|
||||||
|
|
||||||
You do not need the `<path to your db file folder>/sqlite.db` line if you don't use the sqlite database.
|
|
||||||
|
|
||||||
After the container is up and running, you go to `http://localhost` and log in with user: `admin` pass: `admin` and set up the page in the settings.
|
|
||||||
|
|
||||||
**All docker builds**: https://hub.docker.com/r/bpatrik/pigallery2/tags/
|
|
||||||
|
|
||||||
**Note**: You dont need to do the installation steps if you are using docker.
|
**Note**: You dont need to do the installation steps if you are using docker.
|
||||||
|
|
||||||
|
45
docker/README.md
Normal file
45
docker/README.md
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
# PiGallery2 docker installation [](https://hub.docker.com/r/bpatrik/pigallery2/)
|
||||||
|
|
||||||
|
You can use [docker](https://docs.docker.com/install/) to run PiGallery2.
|
||||||
|
|
||||||
|
## all docker tags
|
||||||
|
https://hub.docker.com/r/bpatrik/pigallery2/tags/
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
If you have `docker` and don't want to install all the dependencies, use this:
|
||||||
|
```bash
|
||||||
|
docker run \
|
||||||
|
-p 80:80 \
|
||||||
|
-v <path to your config file folder>/config.json:/app/data/config/config.json \
|
||||||
|
-v <path to your db file folder>:/app/data/db \
|
||||||
|
-v <path to your images folder>:/app/data/images \
|
||||||
|
-v <path to your temp folder>:/app/data/tmp \
|
||||||
|
bpatrik/pigallery2:nightly-stretch
|
||||||
|
```
|
||||||
|
|
||||||
|
After the container is up and running, you go to `http://localhost` and log in with user: `admin` pass: `admin` and set up the page in the settings.
|
||||||
|
|
||||||
|
**Note**: even with `memory` db, pigallery2 creates a db file for storing user credentials (if enabled), so mounting (with `-v`) the `/app/data/db` folder is recommended.
|
||||||
|
|
||||||
|
### before v1.7.0
|
||||||
|
There was a breaking change in Docker files after v1.7.0. Use this to run earlier versions:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run \
|
||||||
|
-p 80:80 \
|
||||||
|
-e NODE_ENV=production \
|
||||||
|
-v <path to your config file folder>/config.json:/pigallery2-release/config.json \
|
||||||
|
-v <path to your db file folder>/sqlite.db:/pigallery2-release/sqlite.db \
|
||||||
|
-v <path to your images folder>:/pigallery2-release/demo/images \
|
||||||
|
-v <path to your temp folder>:/pigallery2-release/demo/TEMP \
|
||||||
|
bpatrik/pigallery2:1.7.0-stretch
|
||||||
|
```
|
||||||
|
Make sure that a file at `<path to your config file folder>/config.json` and `sqlite.db` files exists before running it.
|
||||||
|
|
||||||
|
You do not need the `<path to your db file folder>/sqlite.db` line if you don't use the sqlite database.
|
||||||
|
|
||||||
|
|
||||||
|
### 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](amd64/debian-stretch/selfcontained/Dockerfile)
|
@ -1,25 +0,0 @@
|
|||||||
FROM node:alpine
|
|
||||||
RUN apk add python build-base
|
|
||||||
COPY . /build
|
|
||||||
WORKDIR /build
|
|
||||||
RUN set -x && npm install --unsafe-perm && npm run create-release && \
|
|
||||||
cd /build/release && npm install --unsafe-perm
|
|
||||||
RUN mkdir -p /build/release/data/config && \
|
|
||||||
mkdir -p /build/release/data/db && \
|
|
||||||
mkdir -p /build/release/data/image && \
|
|
||||||
mkdir -p /build/release/data/TEMP && \
|
|
||||||
cd /build/release && npm start -- --config-only || true && \
|
|
||||||
sed -i 's/demo/data/g' config.json && sed -i 's@sqlite\.db@data/db/sqlite\.db@' config.json && \
|
|
||||||
mv /build/release/config.json /build/release/data/config/config.json
|
|
||||||
|
|
||||||
FROM node:alpine
|
|
||||||
WORKDIR /app
|
|
||||||
ENTRYPOINT ["npm", "start"]
|
|
||||||
EXPOSE 80
|
|
||||||
ENV NODE_ENV=production
|
|
||||||
COPY --from=0 /build/release /app
|
|
||||||
RUN ln -s /app/data/config/config.json config.json
|
|
||||||
VOLUME ["/app/data/config", "/app/data/db", "/app/data/images", "/app/data/TEMP"]
|
|
||||||
HEALTHCHECK --interval=15s --timeout=5s --retries=4 --start-period=30s \
|
|
||||||
CMD wget --quiet --tries=1 --no-check-certificate --spider \
|
|
||||||
http://localhost:80 || exit 1
|
|
34
docker/amd64/alpine/Dockerfile
Normal file
34
docker/amd64/alpine/Dockerfile
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
FROM node:12-alpine AS builder
|
||||||
|
RUN apk add python build-base
|
||||||
|
# copying only package{-lock}.json to make node_modules cachable
|
||||||
|
COPY package*.json /build/
|
||||||
|
WORKDIR /build
|
||||||
|
RUN set -x && npm install --unsafe-perm
|
||||||
|
# build app
|
||||||
|
COPY . /build
|
||||||
|
RUN mkdir -p /build/release/data/config && \
|
||||||
|
mkdir -p /build/release/data/db && \
|
||||||
|
mkdir -p /build/release/data/images && \
|
||||||
|
mkdir -p /build/release/data/tmp && \
|
||||||
|
npm run create-release && \
|
||||||
|
cd /build/release && npm install --unsafe-perm && \
|
||||||
|
npm start -- --config-only --force-rewrite-config \
|
||||||
|
--config-path=data/config/config.json \
|
||||||
|
--Server-Database-sqlite-storage='data/db/sqlite.db' \
|
||||||
|
--Server-Database-memory-usersFile='data/db/users.db' \
|
||||||
|
--Server-imagesFolder='data/images' \
|
||||||
|
--Server-Thumbnail-folder='data/tmp' || true
|
||||||
|
|
||||||
|
|
||||||
|
FROM node:12-alpine
|
||||||
|
WORKDIR /app
|
||||||
|
ENTRYPOINT ["npm", "start"]
|
||||||
|
EXPOSE 80
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
COPY --from=builder /build/release /app
|
||||||
|
RUN ln -s /app/data/config/config.json config.json
|
||||||
|
VOLUME ["/app/data/config", "/app/data/db", "/app/data/images", "/app/data/TEMP"]
|
||||||
|
HEALTHCHECK --interval=30s --timeout=10s --retries=4 --start-period=60s \
|
||||||
|
CMD wget --quiet --tries=1 --no-check-certificate --spider \
|
||||||
|
http://localhost:80 || exit 1
|
||||||
|
|
34
docker/amd64/debian-stretch/Dockerfile
Normal file
34
docker/amd64/debian-stretch/Dockerfile
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
FROM node:12-stretch AS builder
|
||||||
|
# LABEL maintainer="Patrik J. Braun"
|
||||||
|
# copying only package{-lock}.json to make node_modules cachable
|
||||||
|
COPY package*.json /build/
|
||||||
|
WORKDIR /build
|
||||||
|
RUN set -x && npm install --unsafe-perm
|
||||||
|
# build app
|
||||||
|
COPY stretch /build
|
||||||
|
RUN mkdir -p /build/release/data/config && \
|
||||||
|
mkdir -p /build/release/data/db && \
|
||||||
|
mkdir -p /build/release/data/images && \
|
||||||
|
mkdir -p /build/release/data/tmp && \
|
||||||
|
npm run create-release && \
|
||||||
|
cd /build/release && npm install --unsafe-perm && \
|
||||||
|
npm start -- --config-only --force-rewrite-config \
|
||||||
|
--config-path=data/config/config.json \
|
||||||
|
--Server-Database-sqlite-storage='data/db/sqlite.db' \
|
||||||
|
--Server-Database-memory-usersFile='data/db/users.db' \
|
||||||
|
--Server-imagesFolder='data/images' \
|
||||||
|
--Server-Thumbnail-folder='data/tmp' || true
|
||||||
|
|
||||||
|
|
||||||
|
FROM node:12-stretch-slim
|
||||||
|
WORKDIR /app
|
||||||
|
ENTRYPOINT ["npm", "start"]
|
||||||
|
EXPOSE 80
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
COPY --from=builder /build/release /app
|
||||||
|
RUN ln -s /app/data/config/config.json config.json
|
||||||
|
VOLUME ["/app/data/config", "/app/data/db", "/app/data/images", "/app/data/TEMP"]
|
||||||
|
HEALTHCHECK --interval=30s --timeout=10s --retries=4 --start-period=60s \
|
||||||
|
CMD wget --quiet --tries=1 --no-check-certificate --spider \
|
||||||
|
http://localhost:80 || exit 1
|
||||||
|
|
32
docker/amd64/debian-stretch/selfcontained/Dockerfile
Normal file
32
docker/amd64/debian-stretch/selfcontained/Dockerfile
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
FROM node:12-stretch 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
|
||||||
|
WORKDIR /build
|
||||||
|
RUN set -x && npm install --unsafe-perm && \
|
||||||
|
mkdir -p /build/release/data/config && \
|
||||||
|
mkdir -p /build/release/data/db && \
|
||||||
|
mkdir -p /build/release/data/images && \
|
||||||
|
mkdir -p /build/release/data/tmp && \
|
||||||
|
npm run create-release && \
|
||||||
|
cd /build/release && npm install --unsafe-perm && \
|
||||||
|
npm start -- --config-only --force-rewrite-config \
|
||||||
|
--config-path=data/config/config.json \
|
||||||
|
--Server-Database-sqlite-storage='data/db/sqlite.db' \
|
||||||
|
--Server-Database-memory-usersFile='data/db/users.db' \
|
||||||
|
--Server-imagesFolder='data/images' \
|
||||||
|
--Server-Thumbnail-folder='data/tmp' || true
|
||||||
|
|
||||||
|
|
||||||
|
FROM node:12-stretch-slim
|
||||||
|
WORKDIR /app
|
||||||
|
ENTRYPOINT ["npm", "start"]
|
||||||
|
EXPOSE 80
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
COPY --from=BUILDER /build/release /app
|
||||||
|
RUN ln -s /app/data/config/config.json config.json
|
||||||
|
VOLUME ["/app/data/config", "/app/data/db", "/app/data/images", "/app/data/TEMP"]
|
||||||
|
HEALTHCHECK --interval=30s --timeout=10s --retries=4 --start-period=60s \
|
||||||
|
CMD wget --quiet --tries=1 --no-check-certificate --spider \
|
||||||
|
http://localhost:80 || exit 1
|
||||||
|
|
40
docker/arm32v6/debian-stretch/Dockerfile
Normal file
40
docker/arm32v6/debian-stretch/Dockerfile
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
FROM alpine AS qemu-builder
|
||||||
|
RUN wget https://github.com/multiarch/qemu-user-static/releases/download/v4.1.1-1/x86_64_qemu-arm-static.tar.gz && \
|
||||||
|
tar -xvf x86_64_qemu-arm-static.tar.gz
|
||||||
|
|
||||||
|
FROM arm32v6/node:12-stretch AS builder
|
||||||
|
COPY --from=qemu-builder /qemu-arm-static /usr/bin
|
||||||
|
# LABEL maintainer="Patrik J. Braun"
|
||||||
|
# copying only package{-lock}.json to make node_modules cachable
|
||||||
|
COPY package*.json /build/
|
||||||
|
WORKDIR /build
|
||||||
|
RUN set -x && npm install --unsafe-perm
|
||||||
|
# build app
|
||||||
|
COPY stretch /build
|
||||||
|
RUN mkdir -p /build/release/data/config && \
|
||||||
|
mkdir -p /build/release/data/db && \
|
||||||
|
mkdir -p /build/release/data/images && \
|
||||||
|
mkdir -p /build/release/data/tmp && \
|
||||||
|
npm run create-release && \
|
||||||
|
cd /build/release && npm install --unsafe-perm && \
|
||||||
|
npm start -- --config-only --force-rewrite-config \
|
||||||
|
--config-path=data/config/config.json \
|
||||||
|
--Server-Database-sqlite-storage='data/db/sqlite.db' \
|
||||||
|
--Server-Database-memory-usersFile='data/db/users.db' \
|
||||||
|
--Server-imagesFolder='data/images' \
|
||||||
|
--Server-Thumbnail-folder='data/tmp' || true
|
||||||
|
|
||||||
|
|
||||||
|
FROM arm32v6/node:12-stretch-slim
|
||||||
|
COPY --from=qemu-builder /qemu-arm-static /usr/bin
|
||||||
|
WORKDIR /app
|
||||||
|
ENTRYPOINT ["npm", "start"]
|
||||||
|
EXPOSE 80
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
COPY --from=builder /build/release /app
|
||||||
|
RUN ln -s /app/data/config/config.json config.json
|
||||||
|
VOLUME ["/app/data/config", "/app/data/db", "/app/data/images", "/app/data/TEMP"]
|
||||||
|
HEALTHCHECK --interval=30s --timeout=10s --retries=4 --start-period=60s \
|
||||||
|
CMD wget --quiet --tries=1 --no-check-certificate --spider \
|
||||||
|
http://localhost:80 || exit 1
|
||||||
|
|
4
docker/arm32v6/debian-stretch/hooks/pre_build
Normal file
4
docker/arm32v6/debian-stretch/hooks/pre_build
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Register qemu-*-static for all supported processors except the
|
||||||
|
# current one, but also remove all registered binfmt_misc before
|
||||||
|
docker run --rm --privileged multiarch/qemu-user-static:register --reset
|
@ -1,14 +0,0 @@
|
|||||||
FROM arm32v7/node:10-stretch
|
|
||||||
LABEL maintainer="Patrik J. Braun"
|
|
||||||
# build tutorial: https://collabnix.com/building-arm-based-docker-images-on-docker-desktop-made-possible-using-buildx/
|
|
||||||
|
|
||||||
RUN git clone https://github.com/bpatrik/pigallery2.git && \
|
|
||||||
cd /pigallery2 && \
|
|
||||||
npm install --unsafe-perm && \
|
|
||||||
npm run create-release && \
|
|
||||||
cp -r /pigallery2/release /pigallery2-release && \
|
|
||||||
rm /pigallery2 -R && \
|
|
||||||
cd /pigallery2-release && \
|
|
||||||
npm install --unsafe-perm
|
|
||||||
|
|
||||||
CMD cd /pigallery2-release && npm start
|
|
@ -1,14 +0,0 @@
|
|||||||
FROM node:10-stretch
|
|
||||||
LABEL maintainer="Patrik J. Braun"
|
|
||||||
|
|
||||||
|
|
||||||
RUN git clone https://github.com/bpatrik/pigallery2.git && \
|
|
||||||
cd /pigallery2 && \
|
|
||||||
npm install --unsafe-perm && \
|
|
||||||
npm run create-release && \
|
|
||||||
cp -r /pigallery2/release /pigallery2-release && \
|
|
||||||
rm /pigallery2 -R && \
|
|
||||||
cd /pigallery2-release && \
|
|
||||||
npm install --unsafe-perm
|
|
||||||
|
|
||||||
CMD cd /pigallery2-release && npm start
|
|
@ -19,23 +19,12 @@ export const SupportedFormats = {
|
|||||||
],
|
],
|
||||||
// These formats need to be transcoded (with the build-in ffmpeg support)
|
// These formats need to be transcoded (with the build-in ffmpeg support)
|
||||||
TranscodeNeed: {
|
TranscodeNeed: {
|
||||||
|
// based on libvips, all supported formats for sharp: https://github.com/libvips/libvips
|
||||||
|
// all supported formats for gm: http://www.graphicsmagick.org/GraphicsMagick.html
|
||||||
Photos: <string[]>[],
|
Photos: <string[]>[],
|
||||||
Videos: [
|
Videos: [
|
||||||
'avi',
|
'avi', 'mkv', 'mov', 'wmv', 'flv', 'mts', 'm2ts', 'mpg', '3gp', 'm4v', 'mpeg', 'vob',
|
||||||
'mkv',
|
'divx', 'xvid', 'ts'
|
||||||
'mov',
|
|
||||||
'wmv',
|
|
||||||
'flv',
|
|
||||||
'mts',
|
|
||||||
'm2ts',
|
|
||||||
'mpg',
|
|
||||||
'3gp',
|
|
||||||
'm4v',
|
|
||||||
'mpeg',
|
|
||||||
'vob',
|
|
||||||
'divx',
|
|
||||||
'xvid',
|
|
||||||
'ts'
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
WithDots: {
|
WithDots: {
|
||||||
|
@ -13,7 +13,7 @@ export class PrivateConfigDefaultsClass extends PublicConfigClass implements IPr
|
|||||||
host: '0.0.0.0',
|
host: '0.0.0.0',
|
||||||
imagesFolder: 'demo/images',
|
imagesFolder: 'demo/images',
|
||||||
Thumbnail: {
|
Thumbnail: {
|
||||||
folder: 'demo/TEMP',
|
folder: 'demo/tmp',
|
||||||
processingLibrary: ServerConfig.ThumbnailProcessingLib.sharp,
|
processingLibrary: ServerConfig.ThumbnailProcessingLib.sharp,
|
||||||
qualityPriority: true,
|
qualityPriority: true,
|
||||||
personFaceMargin: 0.6
|
personFaceMargin: 0.6
|
||||||
|
Loading…
x
Reference in New Issue
Block a user