diff --git a/.github/workflows/docker_test.yaml b/.github/workflows/docker_test.yaml index 0067f337e5..d96621ee66 100644 --- a/.github/workflows/docker_test.yaml +++ b/.github/workflows/docker_test.yaml @@ -26,9 +26,9 @@ jobs: - name: Build Docker Image run: | cd docker - docker-compose -f docker-compose.dev.yml build - docker-compose -f docker-compose.dev.yml run inventree-dev-server invoke update - docker-compose -f docker-compose.dev.yml up -d + docker-compose -f docker-compose.sqlite.yml build + docker-compose -f docker-compose.sqlite.yml run inventree-dev-server invoke update + docker-compose -f docker-compose.sqlite.yml up -d - name: Sleepy Time run: sleep 60 - name: Test API diff --git a/docker/docker-compose.sqlite.yml b/docker/docker-compose.sqlite.yml new file mode 100644 index 0000000000..e42c43a09c --- /dev/null +++ b/docker/docker-compose.sqlite.yml @@ -0,0 +1,62 @@ +version: "3.8" + +# Docker compose recipe for InvenTree development server +# - Runs sqlite database +# - Uses built-in django webserver +# - Runs the InvenTree background worker process +# - Serves media and static content directly from Django webserver + +# IMPORANT NOTE: +# The InvenTree docker image does not clone source code from git. +# Instead, you must specify *where* the source code is located, +# (on your local machine). +# The django server will auto-detect any code changes and reload the server. + +services: + + # InvenTree web server services + # Uses gunicorn as the web server + inventree-dev-server: + container_name: inventree-dev-server + build: + context: . + target: dev + ports: + # Expose web server on port 8000 + - 8000:8000 + volumes: + # Ensure you specify the location of the 'src' directory at the end of this file + - src:/home/inventree + env_file: + # Environment variables required for the dev server are configured in dev-config.env + - sqlite-config.env + restart: unless-stopped + + # Background worker process handles long-running or periodic tasks + inventree-dev-worker: + container_name: inventree-dev-worker + build: + context: . + target: dev + command: invoke worker + depends_on: + - inventree-dev-server + volumes: + # Ensure you specify the location of the 'src' directory at the end of this file + - src:/home/inventree + env_file: + # Environment variables required for the dev server are configured in dev-config.env + - sqlite-config.env + restart: unless-stopped + +volumes: + # NOTE: Change "../" to a directory on your local machine, where the InvenTree source code is located + # 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 + # By default, this directory is one level above the "docker" directory + device: ../ diff --git a/docker/sqlite-config.env b/docker/sqlite-config.env new file mode 100644 index 0000000000..b41660ad6e --- /dev/null +++ b/docker/sqlite-config.env @@ -0,0 +1,10 @@ +# InvenTree environment variables for a development setup + +# Set DEBUG to False for a production environment! +INVENTREE_DEBUG=True +INVENTREE_DEBUG_LEVEL=INFO + +# Database configuration options +# Note: The example setup is for a PostgreSQL database (change as required) +INVENTREE_DB_ENGINE=sqlite +INVENTREE_DB_NAME=/home/inventree/dev/inventree_db.sqlite3