adhere to upstream compose file for v1.0.0

This commit is contained in:
Philipp Fruck 2025-09-17 14:26:21 +02:00
parent 73383eff43
commit f310a238d5
No known key found for this signature in database
GPG key ID: 9B7D2672DB7F47AD
4 changed files with 151 additions and 152 deletions

View file

@ -1,10 +1,8 @@
version: "3.8"
# Docker compose recipe for a production-ready InvenTree setup, with the following containers:
# - PostgreSQL as the database backend
# - gunicorn as the InvenTree web server
# - django-q as the InvenTree background worker process
# - nginx as a reverse proxy
# - Caddy as a reverse proxy
# - redis as the cache manager (optional, disabled by default)
# ---------------------
@ -34,16 +32,20 @@ version: "3.8"
# INVENTREE_TAG=0.7.5
#
# ----------------------------
# Docker compose customization
# ----------------------------
# If you wish to customize the docker-compose script, you should only do so if you understand the stack!
# Do not expect support for customizations that are not part of the standard InvenTree setup!
services:
# Database service
# Use PostgreSQL as the database backend
inventree-db:
image: postgres:13
container_name: inventree-db
image: ${POSTGRES_IMAGE:?You must provide the 'POSTGRES_IMAGE' variable in the .env file}
expose:
- ${INVENTREE_DB_PORT:-5432}/tcp
env_file:
- .env
environment:
- PGDATA=/var/lib/postgresql/data/pgdb
- POSTGRES_USER=${INVENTREE_DB_USER:?You must provide the 'INVENTREE_DB_USER' variable in the .env file}
@ -55,43 +57,39 @@ services:
restart: unless-stopped
# redis acts as database cache manager
# only runs under the "redis" profile : https://docs.docker.com/compose/profiles/
inventree-cache:
image: redis:7-alpine
container_name: inventree-cache
image: ${REDIS_IMAGE:?You must provide the 'REDIS_IMAGE' variable in the .env file}
depends_on:
- inventree-db
env_file:
- .env
profiles:
- redis
expose:
- ${INVENTREE_CACHE_PORT:-6379}
- ${INVENTREE_CACHE_PORT:-6379}
restart: always
# InvenTree web server service
# Uses gunicorn as the web server
inventree-server:
container_name: inventree-server
# If you wish to specify a particular InvenTree version, do so here
image: ${INVENTREE_IMAGE:?You must provide the 'INVENTREE_IMAGE' variable in the .env file}
image: inventree/inventree:${INVENTREE_TAG:-stable}
container_name: inventree-server
# Only change this port if you understand the stack.
expose:
- 8000
env_file:
- .env
- 8000
depends_on:
- inventree-db
- inventree-cache
env_file:
- .env
volumes:
# Data volume must map to /home/inventree/data
- ${INVENTREE_EXT_VOLUME:?You must specify the 'INVENTREE_EXT_VOLUME' variable in the .env file!}:/home/inventree/data:z
- ./plugins:/home/inventree/InvenTree/plugins:z
- ${INVENTREE_EXT_VOLUME}:/home/inventree/data:z
restart: unless-stopped
# Background worker process handles long-running or periodic tasks
inventree-worker:
container_name: inventree-worker
# If you wish to specify a particular InvenTree version, do so here
image: ${INVENTREE_IMAGE:?You must provide the 'INVENTREE_IMAGE' variable in the .env file}
image: inventree/inventree:${INVENTREE_TAG:-stable}
container_name: inventree-worker
command: invoke worker
depends_on:
- inventree-server
@ -99,26 +97,26 @@ services:
- .env
volumes:
# Data volume must map to /home/inventree/data
- ${INVENTREE_EXT_VOLUME:?You must specify the 'INVENTREE_EXT_VOLUME' variable in the .env file!}:/home/inventree/data:z
- ${INVENTREE_EXT_VOLUME}:/home/inventree/data:z
restart: unless-stopped
# nginx acts as a reverse proxy
# static files are served directly by nginx
# media files are served by nginx, although authentication is redirected to inventree-server
# web requests are redirected to gunicorn
# NOTE: You will need to provide a working nginx.conf file!
# caddy acts as reverse proxy and static file server
# https://hub.docker.com/_/caddy
inventree-proxy:
container_name: inventree-proxy
image: ${NGINX_IMAGE:?You must provide the 'NGINX_IMAGE' variable in the .env file}
image: caddy:alpine
restart: always
depends_on:
- inventree-server
ports:
# Default web port is 1337 (can be changed in the .env file)
- ${INVENTREE_WEB_PORT:-1337}:8080
- ${INVENTREE_WEB_PORT:-80}:80
- 443:443
env_file:
- .env
volumes:
# Provide nginx configuration file to the container
# Refer to the provided example file as a starting point
- ./nginx.prod.conf:/etc/nginx/conf.d/default.conf:ro,Z
# nginx proxy needs access to static and media files
- ${INVENTREE_EXT_VOLUME:?You must specify the 'INVENTREE_EXT_VOLUME' variable in the .env file!}:/var/www:z
restart: unless-stopped
- ./Caddyfile:/etc/caddy/Caddyfile:ro,z
- ${INVENTREE_EXT_VOLUME}/static:/var/www/static:z
- ${INVENTREE_EXT_VOLUME}/media:/var/www/media:z
- ${INVENTREE_EXT_VOLUME}:/var/log:z
- ${INVENTREE_EXT_VOLUME}:/data:z
- ${INVENTREE_EXT_VOLUME}:/config:z