Develop: Honor WORKING_DIR in Dockerfile WORKDIR via compose build arg

This commit is contained in:
Michael Mayer 2026-05-22 22:26:24 +00:00
parent 9588d93aa4
commit 0544f71c12
5 changed files with 21 additions and 9 deletions

View file

@ -18,8 +18,8 @@
# In-container working directory and bind mount target for the repo checkout.
# Override when the host clone lives outside the default GOPATH layout; the
# value is reused for working_dir, the source bind mount, and every PhotoPrism
# path env var so they stay in sync.
# value is reused for the Dockerfile WORKDIR (build arg), working_dir, the
# source bind mount, and every PhotoPrism path env var so they stay in sync.
# WORKING_DIR=/go/src/github.com/photoprism/photoprism
# Network interfaces to which Traefik and other services bind on the host.

View file

@ -18,16 +18,19 @@ ENV NPM_CONFIG_IGNORE_SCRIPTS=true
# FROM photoprism/develop:bullseye # Debian 11 (Bullseye)
# FROM photoprism/develop:buster # Debian 10 (Buster)
# Set default working directory.
WORKDIR "/go/src/github.com/photoprism/photoprism"
# Set default working directory. Override WORKING_DIR (e.g. via compose build
# args populated from .env) to match a custom host-side clone layout; the value
# must stay aligned with compose's working_dir and the source bind mount target.
ARG WORKING_DIR=/go/src/github.com/photoprism/photoprism
WORKDIR "${WORKING_DIR}"
# Copy source to image.
COPY . .
COPY --chown=root:root /scripts/dist/ /scripts/
COPY --chown=root:root ./scripts/dist/ /scripts/
# Re-install the dev "mariadb" client config so a custom MARIADB_PORT in .env
# is honored even when the base image was built before the port=<n> line was
# removed (no-op once the next dated base image picks up the new .my.cnf).
COPY --chown=root:root --chmod=644 .my.cnf /etc/my.cnf
COPY --chown=root:root --chmod=644 ./.my.cnf /etc/my.cnf
RUN sudo /scripts/install-yt-dlp.sh

View file

@ -1,7 +1,10 @@
services:
## PhotoPrism (Development Environment for Intel QSV hardware transcoding)
photoprism:
build: .
build:
context: .
args:
WORKING_DIR: "${WORKING_DIR:-/go/src/github.com/photoprism/photoprism}"
image: photoprism/photoprism:develop
depends_on:
- mariadb

View file

@ -1,7 +1,10 @@
services:
## PhotoPrism (Development Environment for Nvidia)
photoprism:
build: .
build:
context: .
args:
WORKING_DIR: "${WORKING_DIR:-/go/src/github.com/photoprism/photoprism}"
image: photoprism/photoprism:develop
runtime: nvidia
depends_on:

View file

@ -4,7 +4,10 @@
services:
## PhotoPrism Build & Test Environment
photoprism:
build: .
build:
context: .
args:
WORKING_DIR: "${WORKING_DIR:-/go/src/github.com/photoprism/photoprism}"
image: photoprism/photoprism:develop
depends_on:
- mariadb