You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

95 lines
3.7 KiB

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
inventree-server:
container_name: inventree-server
# If you wish to specify a particular InvenTree version, do so here
# e.g. image: inventree/inventree:0.5.2
image: inventree/inventree:latest
expose:
- 8000
volumes:
# Data volume must map to /home/inventree/data
- data:/home/inventree/data
restart: unless-stopped
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
inventree-worker:
container_name: inventree-worker
# If you wish to specify a particular InvenTree version, do so here
# e.g. image: inventree/inventree:0.5.2
image: inventree/inventree:latest
command: invoke worker
depends_on:
- inventree-server
volumes:
# Data volume must map to /home/inventree/data
- data:/home/inventree/data
restart: unless-stopped
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!
inventree-proxy:
container_name: inventree-proxy
image: nginx:stable
depends_on:
- inventree-server
ports:
# Change "1337" to the port that you want InvenTree web server to be available on
- 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
# nginx proxy needs access to static and media files
- data:/var/www
restart: unless-stopped
volumes:
# NOTE: Change /path/to/data to a directory on your local machine
# Persistent data, stored external to the container(s)
data:
driver: local
driver_opts:
type: none
o: bind
# This directory specified where InvenTree data are stored "outside" the docker containers
# Change this path to a local system path where you want InvenTree data stored
device: /path/to/data