InvenTree/docker-compose.yml
Oliver 7cabb78964
Docker compose relative path (#3410)
* Update development docker-compose file

- Remove external volume definition
- v2 does not allow relative path spec here
- Simplification is only required for dev version

* Remove old debug messages

* Update docker build CI step

- Check that required directories / files have been created in the correct location(s)

* Add check for pgdb directory

* Run partial docker check on pull_request

* Disable workflow running on pull requests
2022-07-27 07:50:54 +10:00

71 lines
2.6 KiB
YAML

version: "3.8"
# Docker compose recipe for InvenTree development server
# - Runs PostgreSQL as the database backend
# - Uses built-in django webserver
# - Runs the InvenTree background worker process
# - Serves media and static content directly from Django webserver
# IMPORANT NOTE:
# The InvenTree development image does not clone source code from git.
# Instead, it runs from source code on your local machine.
# The django server will auto-detect any code changes and reload the server.
# 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
services:
# 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
expose:
- ${INVENTREE_DB_PORT:-5432}/tcp
environment:
- PGDATA=/var/lib/postgresql/data/pgdb
- POSTGRES_USER=${INVENTREE_DB_USER:?You must provide the 'INVENTREE_DB_USER' variable in the .env file}
- POSTGRES_PASSWORD=${INVENTREE_DB_PASSWORD:?You must provide the 'INVENTREE_DB_PASSWORD' variable in the .env file}
- POSTGRES_DB=${INVENTREE_DB_NAME:?You must provide the 'INVENTREE_DB_NAME' variable in the .env file}
volumes:
# Map 'data' volume such that postgres database is stored externally
- ./data:/var/lib/postgresql/data
restart: unless-stopped
# InvenTree web server service
# Runs the django built-in webserver application
inventree-dev-server:
container_name: inventree-dev-server
depends_on:
- inventree-dev-db
build:
context: .
target: dev
# Cache the built image to be used by the inventree-dev-worker process
image: inventree-dev-image
ports:
# Expose web server on port 8000
- 8000:8000
volumes:
# Mount local source directory to /home/inventree
- ./:/home/inventree
env_file:
- .env
restart: unless-stopped
# Background worker process handles long-running or periodic tasks
inventree-dev-worker:
container_name: inventree-dev-worker
image: inventree-dev-image
command: invoke worker
depends_on:
- inventree-dev-server
volumes:
# Mount local source directory to /home/inventree
- ./:/home/inventree
env_file:
- .env
restart: unless-stopped