Docker: Refactor service initialization and reduce startup log verbosity

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer
2025-04-12 14:06:39 +02:00
parent b03f06a1a2
commit 06de8e2b66
12 changed files with 26 additions and 12 deletions

View File

@@ -39,6 +39,7 @@ ENV PHOTOPRISM_ARCH=$TARGETARCH \
CGO_CFLAGS="-g -O2 -Wno-return-local-addr" \
PROG="photoprism" \
S6_KEEP_ENV=1 \
S6_VERBOSITY=0 \
S6_LOGGING=0
# Copy scripts and package sources config.

View File

@@ -33,7 +33,8 @@ ENV PHOTOPRISM_ARCH=$TARGETARCH \
TF_ENABLE_ONEDNN_OPTS=1 \
MALLOC_ARENA_MAX=4 \
PROG="photoprism" \
S6_KEEP_ENV=1 \
S6_KEEP_ENV=0 \
S6_VERBOSITY=0 \
S6_LOGGING=0
# Copy scripts and package sources config.
@@ -73,6 +74,8 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
/photoprism/storage/config \
/photoprism/storage/cache && \
/scripts/install-s6.sh && \
ln -sf /scripts/services/photoprism /etc/s6-overlay/s6-rc.d/photoprism && \
touch /etc/s6-overlay/s6-rc.d/user/contents.d/photoprism && \
/scripts/cleanup.sh
# Set default working directory.
@@ -83,4 +86,3 @@ EXPOSE 2342 2442 2443
# Set default entrypoint and command.
ENTRYPOINT ["/init"]
CMD ["/scripts/cmd.sh", "tail", "-f", "/dev/null"]

View File

@@ -39,6 +39,7 @@ ENV PHOTOPRISM_ARCH=$TARGETARCH \
CGO_CFLAGS="-g -O2 -Wno-return-local-addr" \
PROG="photoprism" \
S6_KEEP_ENV=1 \
S6_VERBOSITY=0 \
S6_LOGGING=0
# Copy scripts and package sources config.

View File

@@ -33,7 +33,8 @@ ENV PHOTOPRISM_ARCH=$TARGETARCH \
TF_ENABLE_ONEDNN_OPTS=1 \
MALLOC_ARENA_MAX=4 \
PROG="photoprism" \
S6_KEEP_ENV=1 \
S6_KEEP_ENV=0 \
S6_VERBOSITY=0 \
S6_LOGGING=0
# Copy scripts and package sources config.
@@ -74,6 +75,8 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
/photoprism/storage/config \
/photoprism/storage/cache && \
/scripts/install-s6.sh && \
ln -sf /scripts/services/photoprism /etc/s6-overlay/s6-rc.d/photoprism && \
touch /etc/s6-overlay/s6-rc.d/user/contents.d/photoprism && \
/scripts/cleanup.sh
# Set default working directory.
@@ -84,4 +87,3 @@ EXPOSE 2342 2442 2443
# Set default entrypoint and command.
ENTRYPOINT ["/init"]
CMD ["/scripts/cmd.sh", "tail", "-f", "/dev/null"]

View File

@@ -39,6 +39,7 @@ ENV PHOTOPRISM_ARCH=$TARGETARCH \
CGO_CFLAGS="-g -O2 -Wno-return-local-addr" \
PROG="photoprism" \
S6_KEEP_ENV=1 \
S6_VERBOSITY=0 \
S6_LOGGING=0
# Copy scripts and package sources config.

View File

@@ -92,7 +92,8 @@ ENV PHOTOPRISM_ARCH=$TARGETARCH \
PHOTOPRISM_AUTO_INDEX="300" \
PHOTOPRISM_AUTO_IMPORT="-1" \
PHOTOPRISM_INIT="https" \
S6_KEEP_ENV=1 \
S6_KEEP_ENV=0 \
S6_VERBOSITY=0 \
S6_LOGGING=0
# Copy dist files, scripts, and debian backports sources list.
@@ -132,6 +133,8 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
/photoprism/storage/config \
/photoprism/storage/cache && \
/scripts/install-s6.sh && \
ln -sf /scripts/services/photoprism /etc/s6-overlay/s6-rc.d/photoprism && \
touch /etc/s6-overlay/s6-rc.d/user/contents.d/photoprism && \
/scripts/cleanup.sh
# Set default working directory.
@@ -142,4 +145,3 @@ EXPOSE 2342 2443
# Set default entrypoint and command.
ENTRYPOINT ["/init"]
CMD ["/scripts/cmd.sh", "/opt/photoprism/bin/photoprism", "start"]

View File

@@ -101,6 +101,3 @@ EXPOSE 2342 2443
# Copy app files.
COPY --from=build --chown=root:root --chmod=755 /opt/photoprism/ /opt/photoprism
# Start app.
CMD ["/scripts/cmd.sh", "/opt/photoprism/bin/photoprism", "start"]

View File

@@ -101,6 +101,3 @@ EXPOSE 2342 2443
# Copy app files.
COPY --from=build --chown=root:root --chmod=755 /opt/photoprism/ /opt/photoprism
# Start app.
CMD ["/scripts/cmd.sh", "/opt/photoprism/bin/photoprism", "start"]

View File

@@ -83,4 +83,11 @@ curl -fsSL "$S6_NOARCH_URL" | tar -C "${S6_OVERLAY_DESTDIR}" -Jxp
echo "Extracting \"$S6_BINARY_URL\" to \"$S6_OVERLAY_DESTDIR\"..."
curl -fsSL "$S6_BINARY_URL" | tar -C "${S6_OVERLAY_DESTDIR}" -Jxp
S6_USER2_BUNDLE="${S6_OVERLAY_DESTDIR}etc/s6-overlay/s6-rc.d/user2"
if [ -d "$S6_USER2_BUNDLE" ]; then
echo "Removing \"${S6_USER2_BUNDLE}\"..."
rm -rf "${S6_OVERLAY_DESTDIR}etc/s6-overlay/s6-rc.d/user2"
fi
echo "Done."

View File

3
scripts/dist/services/photoprism/run vendored Normal file
View File

@@ -0,0 +1,3 @@
#!/command/execlineb -P
with-contenv
/scripts/cmd.sh /opt/photoprism/bin/photoprism start

1
scripts/dist/services/photoprism/type vendored Normal file
View File

@@ -0,0 +1 @@
longrun