2021-05-10 04:23:17 +00:00
|
|
|
version: "3.8"
|
|
|
|
|
|
|
|
# Docker compose recipe for InvenTree development server
|
2021-12-20 13:34:23 +00:00
|
|
|
# - Runs PostgreSQL as the database backend
|
2021-05-10 04:23:17 +00:00
|
|
|
# - Uses built-in django webserver
|
2021-12-20 13:34:23 +00:00
|
|
|
# - Runs the InvenTree background worker process
|
|
|
|
# - Serves media and static content directly from Django webserver
|
2021-05-10 04:23:17 +00:00
|
|
|
|
|
|
|
# IMPORANT NOTE:
|
2022-04-19 12:09:30 +00:00
|
|
|
# The InvenTree development image does not clone source code from git.
|
|
|
|
# Instead, you must specify *where* the source code is located, (on your local machine).
|
|
|
|
# The default setup in this file should work straight out of the box, without modification
|
2021-05-10 04:23:17 +00:00
|
|
|
# The django server will auto-detect any code changes and reload the server.
|
|
|
|
|
|
|
|
services:
|
2021-12-20 13:34:23 +00:00
|
|
|
|
|
|
|
# Database service
|
|
|
|
# Use PostgreSQL as the database backend
|
|
|
|
# Note: This can be changed to a different backend if required
|
|
|
|
inventree-dev-db:
|
|
|
|
container_name: inventree-dev-db
|
|
|
|
image: postgres:13
|
|
|
|
ports:
|
|
|
|
- 5432/tcp
|
|
|
|
environment:
|
|
|
|
- PGDATA=/var/lib/postgresql/data/dev/pgdb
|
|
|
|
# The pguser and pgpassword values must be the same in the other containers
|
|
|
|
# Ensure that these are correctly configured in your dev-config.env file
|
|
|
|
- POSTGRES_USER=pguser
|
|
|
|
- POSTGRES_PASSWORD=pgpassword
|
|
|
|
volumes:
|
|
|
|
# Map 'data' volume such that postgres database is stored externally
|
|
|
|
- src:/var/lib/postgresql/data
|
|
|
|
restart: unless-stopped
|
|
|
|
|
2021-05-10 04:23:17 +00:00
|
|
|
# InvenTree web server services
|
|
|
|
# Uses gunicorn as the web server
|
2021-06-15 13:05:03 +00:00
|
|
|
inventree-dev-server:
|
|
|
|
container_name: inventree-dev-server
|
2021-12-20 13:34:23 +00:00
|
|
|
depends_on:
|
|
|
|
- inventree-dev-db
|
2021-05-12 10:53:50 +00:00
|
|
|
build:
|
|
|
|
context: .
|
|
|
|
target: dev
|
2021-05-10 04:23:17 +00:00
|
|
|
ports:
|
2021-08-17 10:00:54 +00:00
|
|
|
# Expose web server on port 8000
|
2021-05-12 11:35:54 +00:00
|
|
|
- 8000:8000
|
2022-01-19 01:31:35 +00:00
|
|
|
# Note: If using the inventree-dev-proxy container (see below),
|
|
|
|
# comment out the "ports" directive (above) and uncomment the "expose" directive
|
|
|
|
#expose:
|
|
|
|
# - 8000
|
2021-05-10 04:23:17 +00:00
|
|
|
volumes:
|
|
|
|
# Ensure you specify the location of the 'src' directory at the end of this file
|
2021-06-15 13:05:03 +00:00
|
|
|
- src:/home/inventree
|
2021-05-12 11:15:53 +00:00
|
|
|
env_file:
|
|
|
|
# Environment variables required for the dev server are configured in dev-config.env
|
|
|
|
- dev-config.env
|
2021-05-10 04:23:17 +00:00
|
|
|
restart: unless-stopped
|
|
|
|
|
|
|
|
# Background worker process handles long-running or periodic tasks
|
2021-06-15 13:05:03 +00:00
|
|
|
inventree-dev-worker:
|
|
|
|
container_name: inventree-dev-worker
|
2021-05-12 10:53:50 +00:00
|
|
|
build:
|
|
|
|
context: .
|
|
|
|
target: dev
|
2021-08-17 23:52:27 +00:00
|
|
|
command: invoke worker
|
2021-05-12 12:12:26 +00:00
|
|
|
depends_on:
|
2021-06-15 13:05:03 +00:00
|
|
|
- inventree-dev-server
|
2021-05-10 04:23:17 +00:00
|
|
|
volumes:
|
|
|
|
# Ensure you specify the location of the 'src' directory at the end of this file
|
2021-06-15 13:05:03 +00:00
|
|
|
- src:/home/inventree
|
2021-05-12 11:15:53 +00:00
|
|
|
env_file:
|
|
|
|
# Environment variables required for the dev server are configured in dev-config.env
|
|
|
|
- dev-config.env
|
2021-05-10 04:23:17 +00:00
|
|
|
restart: unless-stopped
|
|
|
|
|
2022-01-19 01:31:35 +00:00
|
|
|
### Optional: Serve static and media files using nginx
|
|
|
|
### Uncomment the following lines to enable nginx proxy for testing
|
2022-01-19 01:32:30 +00:00
|
|
|
### Note: If enabling the proxy, change "ports" to "expose" for the inventree-dev-server container (above)
|
2022-01-19 01:31:35 +00:00
|
|
|
#inventree-dev-proxy:
|
|
|
|
# container_name: inventree-dev-proxy
|
|
|
|
# image: nginx:stable
|
|
|
|
# depends_on:
|
|
|
|
# - inventree-dev-server
|
|
|
|
# ports:
|
|
|
|
# # Change "8000" to the port that you want InvenTree web server to be available on
|
|
|
|
# - 8000:80
|
|
|
|
# volumes:
|
|
|
|
# # Provide ./nginx.conf file to the container
|
|
|
|
# # Refer to the provided example file as a starting point
|
|
|
|
# - ./nginx.dev.conf:/etc/nginx/conf.d/default.conf:ro
|
|
|
|
# # nginx proxy needs access to static and media files
|
|
|
|
# - src:/var/www
|
|
|
|
# restart: unless-stopped
|
|
|
|
|
2021-05-10 04:23:17 +00:00
|
|
|
volumes:
|
2021-06-15 13:19:50 +00:00
|
|
|
# NOTE: Change "../" to a directory on your local machine, where the InvenTree source code is located
|
2021-05-10 04:23:17 +00:00
|
|
|
# Persistent data, stored external to the container(s)
|
|
|
|
src:
|
|
|
|
driver: local
|
|
|
|
driver_opts:
|
|
|
|
type: none
|
|
|
|
o: bind
|
|
|
|
# This directory specified where InvenTree source code is stored "outside" the docker containers
|
2021-06-15 13:05:03 +00:00
|
|
|
# By default, this directory is one level above the "docker" directory
|
|
|
|
device: ../
|