Files
homelab/photoview/docker-compose.yml
2026-02-28 07:07:53 -06:00

67 lines
2.6 KiB
YAML

services:
## Makes sure that the media cache folder is created with the correct permissions
photoview-prepare:
image: photoview/photoview:latest
hostname: photoview-prepare
container_name: photoview-prepare
network_mode: "none"
user: root
entrypoint: []
command: /bin/bash -c "sleep 1 && chown -R photoview:photoview /home/photoview/media-cache"
cap_add:
- CHOWN
volumes:
- "/etc/localtime:/etc/localtime:ro"
- "${HOST_PHOTOVIEW_LOCATION}/timezone.txt:/etc/timezone:ro"
- "${HOST_PHOTOVIEW_LOCATION}/storage:/home/photoview/media-cache"
photoview:
image: photoview/photoview:latest
hostname: photoview
container_name: photoview
restart: unless-stopped
stop_grace_period: 10s
networks:
- ui_net
- api_db_net
ports:
- "${PHOTOVIEW_PORT}:80" ## HTTP port (host:container)
## Comment out the entire `depends_on` section if PHOTOVIEW_DATABASE_DRIVER is set to `sqlite` in the .env
# depends_on:
# photoview-prepare:
# condition: service_completed_successfully
# mariadb:
# condition: service_healthy
## Security options for some restricted systems
security_opt:
- seccomp:unconfined
- apparmor:unconfined
environment:
PHOTOVIEW_DATABASE_DRIVER: ${PHOTOVIEW_DATABASE_DRIVER}
## Comment out the next variable in the case PHOTOVIEW_DATABASE_DRIVER is set to `sqlite` or `postgres` in the .env
PHOTOVIEW_MYSQL_URL: "${MARIADB_USER}:${MARIADB_PASSWORD}@tcp(photoview-mariadb)/${MARIADB_DATABASE}"
## Uncomment the next line if PHOTOVIEW_DATABASE_DRIVER is set to `sqlite` in the .env
# PHOTOVIEW_SQLITE_PATH: ${PHOTOVIEW_SQLITE_PATH}
## Uncomment the next variable if set in the `.env` file
# PHOTOVIEW_UI_ENDPOINTS: ${PHOTOVIEW_UI_ENDPOINTS}
PHOTOVIEW_LISTEN_IP: "0.0.0.0"
## Optional: To enable map related features, you need to create a mapbox token.
## A token can be generated for free here https://account.mapbox.com/access-tokens/
## It's a good idea to limit the scope of the token to your own domain, to prevent others from using it.
MAPBOX_TOKEN: ${MAPBOX_TOKEN}
volumes:
- "/etc/localtime:/etc/localtime:ro"
- "${HOST_PHOTOVIEW_LOCATION}/timezone.txt:/etc/timezone:ro"
## Uncomment the next line if PHOTOVIEW_DATABASE_DRIVER is set to `sqlite` in the .env
- "${HOST_PHOTOVIEW_LOCATION}/database:/home/photoview/database"
- "${HOST_PHOTOVIEW_LOCATION}/storage:/home/photoview/media-cache"
- "${HOST_PHOTOVIEW_MEDIA_ROOT}:/photos:ro"
networks:
ui_net:
driver: bridge
api_db_net:
internal: true