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.
|
2022-04-20 13:15:37 +00:00
|
|
|
# Instead, it runs from source code on your local machine.
|
2021-05-10 04:23:17 +00:00
|
|
|
# The django server will auto-detect any code changes and reload the server.
|
|
|
|
|
2022-04-20 13:15:37 +00:00
|
|
|
# If you have cloned the InvenTree git repo, and not made any changes to this file,
|
|
|
|
# then the default setup in this file should work straight out of the box, without modification
|
|
|
|
|
2021-05-10 04:23:17 +00:00
|
|
|
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
|
2022-07-18 04:08:33 +00:00
|
|
|
expose:
|
2022-07-30 00:34:16 +00:00
|
|
|
- 5432/tcp
|
2021-12-20 13:34:23 +00:00
|
|
|
environment:
|
2022-07-26 21:50:54 +00:00
|
|
|
- PGDATA=/var/lib/postgresql/data/pgdb
|
2022-07-30 00:34:16 +00:00
|
|
|
- POSTGRES_USER=pguser
|
|
|
|
- POSTGRES_PASSWORD=pgpassword
|
|
|
|
- POSTGRES_DB=inventree
|
2021-12-20 13:34:23 +00:00
|
|
|
volumes:
|
|
|
|
# Map 'data' volume such that postgres database is stored externally
|
2023-02-19 20:21:17 +00:00
|
|
|
- ./data:/var/lib/postgresql/data:z
|
2021-12-20 13:34:23 +00:00
|
|
|
restart: unless-stopped
|
|
|
|
|
2022-07-26 21:50:54 +00:00
|
|
|
# InvenTree web server service
|
|
|
|
# Runs the django built-in webserver application
|
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
|
2023-02-19 20:21:17 +00:00
|
|
|
build: &build_config
|
2021-05-12 10:53:50 +00:00
|
|
|
context: .
|
|
|
|
target: dev
|
2022-04-20 13:52:56 +00:00
|
|
|
# Cache the built image to be used by the inventree-dev-worker process
|
|
|
|
image: inventree-dev-image
|
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
|
2021-05-10 04:23:17 +00:00
|
|
|
volumes:
|
2022-07-26 21:50:54 +00:00
|
|
|
# Mount local source directory to /home/inventree
|
2023-02-19 20:21:17 +00:00
|
|
|
- ./:/home/inventree:z
|
2021-05-12 11:15:53 +00:00
|
|
|
env_file:
|
2022-07-30 00:34:16 +00:00
|
|
|
- docker.dev.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
|
2022-04-20 13:52:56 +00:00
|
|
|
image: inventree-dev-image
|
2023-02-19 20:21:17 +00:00
|
|
|
build: *build_config
|
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:
|
2022-07-26 21:50:54 +00:00
|
|
|
# Mount local source directory to /home/inventree
|
2023-02-19 20:21:17 +00:00
|
|
|
- ./:/home/inventree:z
|
2021-05-12 11:15:53 +00:00
|
|
|
env_file:
|
2022-07-30 00:34:16 +00:00
|
|
|
- docker.dev.env
|
2021-05-10 04:23:17 +00:00
|
|
|
restart: unless-stopped
|