# Multi-stage: build from source in a full development image, then run in a lightweight runtime
FROM photoprism/develop:260309-questing AS builder
# Harden npm usage by default (applies to npm ci / install in dev container)
ENV NPM_CONFIG_IGNORE_SCRIPTS=true
# Set working directory for build
WORKDIR "/go/src/github.com/photoprism/photoprism"
# Copy source
COPY . .
# Copy helper scripts (adjusted to build context path)
COPY --chown=root:root scripts/dist/ /scripts/
# Install additional tooling required by build (yt-dlp and others)
RUN /scripts/install-yt-dlp.sh
# Build the project for production
RUN make build-prod
# Install built artifacts to a staging directory for runtime
RUN DESTDIR=/photoprism make install
# Runtime stage: keep image lean and focused on running photoprism
FROM debian:bookworm-slim
# Minimal runtime environment
ENV NPM_CONFIG_IGNORE_SCRIPTS=true
RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates tzdata && \
rm -rf /var/lib/apt/lists/*
# Copy built photoprism from builder
COPY --from=builder /photoprism /photoprism
# Create a non-root user to run the application
RUN useradd -m -u 1000 photoprism
RUN chown -R photoprism:photoprism /photoprism
USER photoprism
WORKDIR /photoprism
# Expose the default web port
EXPOSE 2342
# Run photoprism in daemon mode by default
CMD ["bin/photoprism","start","-d"]
# Ignore git /.git # Node modules and build artifacts node_modules/ frontend/node_modules/ # Local dev envs .env .env.* # Logs *.log # Photoprism assets build outputs assets/static/build build assets/docs # Docker *.dockerfile .dockerignore # Misc .tmp *.swp
Summary of Docker build error - Failing command/step: - [builder 6/7] RUN make build-prod (Dockerfile: line 19) - Exact error message and exit code: - Exact error (repeated in logs): fatal: not a git repository (or any of the parent directories): .git - Underlying step exit: Makefile:367: build-prod] Error 128 - Docker build result: ERROR: failed to build: failed to solve: process "/bin/sh -c make build-prod" did not complete successfully: exit code: 2 - Missing packages or files mentioned: - The error indicates the repository is not a git repository (missing .git directory) when running make build-prod. This suggests the build context does not include Git metadata, causing Git commands invoked by the build to fail. - Version mismatch info: - No explicit version mismatch detected in the log. The failure stems from missing Git metadata (.git) rather than a version conflict. The base image used is photoprism/develop:260309-questing, but no mismatch is indicated as the root cause.
# Ignore git #/.git # Node modules and build artifacts node_modules/ frontend/node_modules/ # Local dev envs .env .env.* # Logs *.log # Photoprism assets build outputs assets/static/build build assets/docs # Docker *.dockerfile .dockerignore # Misc .tmp *.swp
# Multi-stage: build from source in a full development image, then run in a lightweight runtime
FROM photoprism/develop:260309-questing AS builder
# Harden npm usage by default (applies to npm ci / install in dev container)
ENV NPM_CONFIG_IGNORE_SCRIPTS=true
# Set working directory for build
WORKDIR "/go/src/github.com/photoprism/photoprism"
# Copy source
COPY . .
# Copy helper scripts (adjusted to build context path)
COPY --chown=root:root scripts/dist/ /scripts/
# Install additional tooling required by build (yt-dlp and others)
RUN /scripts/install-yt-dlp.sh
# Build the project for production. Bypass git-describe by providing a static BUILD_TAG
RUN BUILD_TAG=docker-build make build-prod
# Install built artifacts to a staging directory for runtime
RUN DESTDIR=/photoprism make install
# Runtime stage: keep image lean and focused on running photoprism
FROM debian:bookworm-slim
# Minimal runtime environment
ENV NPM_CONFIG_IGNORE_SCRIPTS=true
RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates tzdata ffmpeg && \
rm -rf /var/lib/apt/lists/*
# Copy built photoprism from builder
COPY --from=builder /photoprism /photoprism
# Create a non-root user to run the application
RUN useradd -m -u 1000 photoprism
RUN chown -R photoprism:photoprism /photoprism
USER photoprism
WORKDIR /photoprism
# Expose the default web port
EXPOSE 2342
# Run photoprism in foreground
CMD ["/photoprism/bin/photoprism","start","-d"]
Exact error message and exit code - ERROR: Install path '/photoprism' already exists! - Exit code: 2 Failing command/step - [builder 7/7] RUN DESTDIR=/photoprism make install - Log excerpt shows: Installing in "/photoprism"..., then the error: "ERROR: Install path '/photoprism' already exists!" "make: *** [Makefile:196: install] Error 1" - Overall failure: process "/bin/sh -c DESTDIR=/photoprism make install" did not complete successfully: exit code: 2 Missing packages or files mentioned - None explicitly mentioned as missing. The error is a pre-existing install directory conflict, not a missing file/package. Version mismatch info - Build context shows: - Building PhotoPrism 260322-08fb7d8-Linux-AMD64 (prod) - Compiling with go version go1.26.1 linux/amd64 - No version mismatch is reported in the error. Additional module downloads occurred prior to this step (no failures noted).
# Multi-stage: build from source in a full development image, then run in a lightweight runtime
FROM photoprism/develop:260309-questing AS builder
# Harden npm usage by default (applies to npm ci / install in dev container)
ENV NPM_CONFIG_IGNORE_SCRIPTS=true
# Set working directory for build
WORKDIR "/go/src/github.com/photoprism/photoprism"
# Copy source
COPY . .
# Copy helper scripts (adjusted to build context path)
COPY --chown=root:root scripts/dist/ /scripts/
# Install additional tooling required by build (yt-dlp and others)
RUN /scripts/install-yt-dlp.sh
# Build the project for production. Bypass git-describe by providing a static BUILD_TAG and BUILD_VERSION
RUN BUILD_TAG=docker-build BUILD_VERSION=dev BUILD_DATE=20250101 make build-prod
# Install built artifacts to a staging directory for runtime
RUN DESTDIR=/build/photoprism make install
# Runtime stage: keep image lean and focused on running photoprism
FROM debian:bookworm-slim
# Minimal runtime environment
ENV NPM_CONFIG_IGNORE_SCRIPTS=true
RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates tzdata ffmpeg && \
rm -rf /var/lib/apt/lists/*
# Copy built photoprism from builder
COPY --from=builder /build/photoprism /photoprism
# Create a non-root user to run the application
RUN useradd -m -u 1000 photoprism
RUN chown -R photoprism:photoprism /photoprism
USER photoprism
WORKDIR /photoprism
# Expose the default web port
EXPOSE 2342
# Run photoprism in foreground
CMD ["/photoprism/bin/photoprism","start"]
Concerns: COPY --chown=root:root scripts/dist/ /scripts/ may fail if scripts/dist is not present in the build context., FROM photoprism/develop:260309-questing must be available in the registry; ensure the tag exists and is accessible., Starting the app via CMD may rely on /photoprism/bin/photoprism; verify this path and that the 'start' subcommand is correct for this release. Smoke [PASS]: test -x /photoprism/bin/photoprism && echo ok || exit 1 Smoke [PASS]: ffmpeg -version >/dev/null 2>&1 && echo ok || exit 1 Smoke [PASS]: test -d /photoprism && echo ok || exit 1