From e73db9d2843d608e8f03001d594f99ca13d95413 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sun, 29 May 2022 00:22:07 +1000 Subject: [PATCH] Simplify docker development instructions --- docs/start/docker_dev.md | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/docs/start/docker_dev.md b/docs/start/docker_dev.md index 853210e..08c1759 100644 --- a/docs/start/docker_dev.md +++ b/docs/start/docker_dev.md @@ -6,29 +6,32 @@ title: Docker Development Server You can use docker to launch and manage a development server, in a similar fashion to managing a production server. +The InvenTree dockerfile (`./Dockerfile`) uses a [multi-stage build](https://docs.docker.com/develop/develop-images/multistage-build/) process to allow both production and development setups from the same image. + There are some key differences compared to the [docker production setup](./docker_prod.md): - The docker image is built locally, rather than being downloaded from DockerHub -- The docker image points to the source code on your local machine, instead of cloning from GitHub +- The docker image points to the source code on your local machine (mounted as a 'volume' in the docker container) - The django webserver is used, instead of running behind Gunicorn - The server will automatically reload when code changes are detected !!! info "Static and Media Files" The development server runs in DEBUG mode, and serves static and media files natively. -The InvenTree dockerfile (`./docker/Dockerfile`) uses a [multi-stage build](https://docs.docker.com/develop/develop-images/multistage-build/) process to allow both production and development setups from the same image. The key difference is that the production image is pre-built using InvenTree source code from GitHub, while the development image uses the source code from your local machine (allowing live code updates). - !!! info "Hacker Mode" The following setup guide starts a development server which will reload "on the fly" as changes are made to the source code. This is designed for programmers and developers who wish to add and test new InvenTree features. ## Development Setup Guide -!!! info "Starting Point" - This setup guide assumes you are starting in the `./docker/` directory. +To get started with an InvenTree development setup, follow the simple steps outlined below. Before continuing, ensure that you have completed the following steps: -### Edit Environment Variables +- Downloaded the InvenTree source code to your local machine +- Installed docker on your local machine (install *Docker Desktop* on Windows) +- Have a terminal open to the root directory of the InvenTree source code -If required, the user may edit the environment variables, located in the `.env` file. +### Edit Environment Variables (Optional) + +If desired, the user may edit the environment variables, located in the `.env` file. !!! success "This step is optional" This step can be skipped, as the default variables will work just fine! @@ -36,16 +39,6 @@ If required, the user may edit the environment variables, located in the `.env` !!! info "Database Credentials" You may also wish to change the database username (`INVENTREE_DB_USER`) and password (`INVENTREE_DB_PASSWORD`) from their default values -### Create Database - -Launch the postgresql database container, and create an empty database, with the following command: - -```bash -docker-compose run -d inventree-dev-db -``` - -This will start the `inventree-dev-db` container (in the background) and create an empty database. - ### Perform Initial Setup The database has now been created, but it is empty! Perform the initial database setup by running the following command: