1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2024-12-25 02:04:15 +02:00

Add build time diagnostics to docker to test failing sharp #588 #295

This commit is contained in:
Patrik J. Braun 2023-01-13 00:32:58 +01:00
parent b107d28281
commit 203fc798ac
5 changed files with 27 additions and 3 deletions

View File

@ -29,6 +29,9 @@ RUN apk add --update-cache --repository https://alpine.global.ssl.fastly.net/alp
vips ffmpeg vips ffmpeg
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"]
# Run build time diagnostics to make sure the app would work after build is finished
RUN ["node", "./src/backend/index", "--expose-gc", "--run-diagnostics", "--config-path=/app/diagnostics-config.json"]
HEALTHCHECK --interval=40s --timeout=30s --retries=3 --start-period=60s \ HEALTHCHECK --interval=40s --timeout=30s --retries=3 --start-period=60s \
CMD wget --quiet --tries=1 --no-check-certificate --spider \ CMD wget --quiet --tries=1 --no-check-certificate --spider \
http://localhost:80/heartbeat || exit 1 http://localhost:80/heartbeat || exit 1

View File

@ -29,6 +29,9 @@ RUN apt-get update \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
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"]
# Run build time diagnostics to make sure the app would work after build is finished
RUN ["node", "./src/backend/index", "--expose-gc", "--run-diagnostics", "--config-path=/app/diagnostics-config.json"]
HEALTHCHECK --interval=40s --timeout=30s --retries=3 --start-period=60s \ HEALTHCHECK --interval=40s --timeout=30s --retries=3 --start-period=60s \
CMD wget --quiet --tries=1 --no-check-certificate --spider \ CMD wget --quiet --tries=1 --no-check-certificate --spider \
http://localhost:80/heartbeat || exit 1 http://localhost:80/heartbeat || exit 1

View File

@ -29,6 +29,9 @@ RUN apt-get update \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
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"]
# Run build time diagnostics to make sure the app would work after build is finished
RUN ["node", "./src/backend/index", "--expose-gc", "--run-diagnostics", "--config-path=/app/diagnostics-config.json"]
HEALTHCHECK --interval=40s --timeout=30s --retries=3 --start-period=60s \ HEALTHCHECK --interval=40s --timeout=30s --retries=3 --start-period=60s \
CMD wget --quiet --tries=1 --no-check-certificate --spider \ CMD wget --quiet --tries=1 --no-check-certificate --spider \
http://localhost:80/heartbeat || exit 1 http://localhost:80/heartbeat || exit 1

View File

@ -33,6 +33,9 @@ RUN apt-get update \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
COPY --from=builder /build/release /app COPY --from=builder /build/release /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"]
# Run build time diagnostics to make sure the app would work after build is finished
RUN ["node", "./src/backend/index", "--expose-gc", "--run-diagnostics", "--config-path=/app/diagnostics-config.json"]
HEALTHCHECK --interval=40s --timeout=30s --retries=3 --start-period=60s \ HEALTHCHECK --interval=40s --timeout=30s --retries=3 --start-period=60s \
CMD wget --quiet --tries=1 --no-check-certificate --spider \ CMD wget --quiet --tries=1 --no-check-certificate --spider \
http://localhost:80/heartbeat || exit 1 http://localhost:80/heartbeat || exit 1

View File

@ -1,9 +1,21 @@
import * as cluster from 'cluster'; import * as cluster from 'cluster';
import {Server} from './server'; import {Server} from './server';
import {Worker} from './model/threading/Worker'; import {Worker} from './model/threading/Worker';
import {ConfigDiagnostics} from './model/diagnostics/ConfigDiagnostics';
if ((cluster as any).isMaster) {
new Server(); if ((process.argv || []).includes('--run-diagnostics')) {
console.log('Running diagnostics and exiting.');
ConfigDiagnostics.runDiagnostics().catch((e) => {
console.error(e);
process.exit(1);
}).then(() => {
process.exit(0);
});
} else { } else {
Worker.process(); if ((cluster as any).isMaster) {
new Server();
} else {
Worker.process();
}
} }