photoprism-photoprism
SUCCESS
20m 38s
History Source
SummaryIterations1Transcript13Dockerfile
Dockerfile36 lines · 1076 chars
# Stage 1: Builder
FROM photoprism/develop:260309-questing AS builder

# Ensure npm scripts are not run during install in this dev container
ENV NPM_CONFIG_IGNORE_SCRIPTS=true

# Set working directory to repository root (as in the repo layout)
WORKDIR "/go/src/github.com/photoprism/photoprism"

# Copy source to image
COPY . .

# Install/build dependencies and build both back-end (Go) and front-end (JS)
RUN make dep && make build-go && make build-js

# Stage 2: Runtime
FROM photoprism/develop:260309-questing AS runtime

# Create a non-root user to run the server
RUN id -u photoprism >/dev/null 2>&1 || useradd -m photoprism

WORKDIR "/go/src/github.com/photoprism/photoprism"

# Copy the built artifacts from the builder
COPY --from=builder /go/src/github.com/photoprism/photoprism /go/src/github.com/photoprism/photoprism

# Ensure correct permissions for the non-root user
RUN chown -R photoprism:photoprism /go/src/github.com/photoprism/photoprism
USER photoprism

# Expose the default PhotoPrism port
EXPOSE 2342

# Run the server in foreground
CMD ["./photoprism"]