version: "3.8"
|
|
|
|
# Docker compose recipe for InvenTree
|
|
# - Runs PostgreSQL as the database backend
|
|
# - Runs Gunicorn as the InvenTree web server
|
|
# - Runs the InvenTree background worker process
|
|
# - Runs nginx as a reverse proxy
|
|
|
|
# ---------------------------------
|
|
# IMPORTANT - READ BEFORE STARTING!
|
|
# ---------------------------------
|
|
# Before running, ensure that you change the "/path/to/data" directory,
|
|
# specified in the "volumes" section at the end of this file.
|
|
# This path determines where the InvenTree data will be stored!
|
|
#
|
|
|
|
services:
|
|
# InvenTree web server services
|
|
# Uses gunicorn as the web server
|
|
core:
|
|
container_name: ${INVENTREE_CORE_CONTAINER_NAME:-inventree_core}
|
|
image: inventree/inventree:${INVENTREE_VERSION:-latest}
|
|
restart: unless-stopped
|
|
expose:
|
|
- 8000
|
|
volumes:
|
|
- ./data:/home/inventree/data
|
|
environment:
|
|
INVENTREE_DEBUG: False
|
|
INVENTREE_LOG_LEVEL: WARNING
|
|
INVENTREE_DB_ENGINE: mysql
|
|
INVENTREE_DB_HOST: ${INVENTREE_DB_HOST:?err}
|
|
INVENTREE_DB_PORT: ${INVENTREE_DB_PORT:?err}
|
|
INVENTREE_DB_NAME: ${INVENTREE_DB_NAME:?err}
|
|
INVENTREE_DB_USER: ${INVENTREE_DB_USER:?err}
|
|
INVENTREE_DB_PASSWORD: ${INVENTREE_DB_PASSWORD:?err}
|
|
|
|
# Background worker process handles long-running or periodic tasks
|
|
worker:
|
|
container_name: ${INVENTREE_WORKER_CONTAINER_NAME:-inventree_worker}
|
|
image: inventree/inventree:${INVENTREE_VERSION:-latest}
|
|
restart: unless-stopped
|
|
command: invoke worker
|
|
depends_on:
|
|
- core
|
|
volumes:
|
|
- ./data:/home/inventree/data
|
|
environment:
|
|
INVENTREE_DEBUG: False
|
|
INVENTREE_LOG_LEVEL: WARNING
|
|
INVENTREE_DB_ENGINE: mysql
|
|
INVENTREE_DB_HOST: ${INVENTREE_DB_HOST:?err}
|
|
INVENTREE_DB_PORT: ${INVENTREE_DB_PORT:?err}
|
|
INVENTREE_DB_NAME: ${INVENTREE_DB_NAME:?err}
|
|
INVENTREE_DB_USER: ${INVENTREE_DB_USER:?err}
|
|
INVENTREE_DB_PASSWORD: ${INVENTREE_DB_PASSWORD:?err}
|
|
|
|
# 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!
|
|
proxy:
|
|
container_name: ${INVENTREE_PROXY_CONTAINER_NAME:-inventree_proxy}
|
|
image: nginx:${INVENTREE_PROXY_VERSION:-stable}
|
|
restart: unless-stopped
|
|
depends_on:
|
|
- core
|
|
ports:
|
|
- ${INVENTREE_HOST_IP_ADDRESS:-127.0.0.1}:${INVENTREE_HOST_PORT:-1337}:80
|
|
volumes:
|
|
# Provide ./nginx.conf file to the container
|
|
# Refer to the provided example file as a starting point
|
|
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
|
- ./data:/var/www
|