mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
All "development" related stuff now goes under ./dev
- Update dev-config.env - Update docker-compose.dev.yml - Development target of Dockerfile no longer creates any folders - Update entry point scripts
This commit is contained in:
parent
8da00c6106
commit
01328075ea
5
.gitignore
vendored
5
.gitignore
vendored
@ -61,4 +61,7 @@ secret_key.txt
|
|||||||
|
|
||||||
# Coverage reports
|
# Coverage reports
|
||||||
.coverage
|
.coverage
|
||||||
htmlcov/
|
htmlcov/
|
||||||
|
|
||||||
|
# Development files
|
||||||
|
.dev/
|
@ -101,14 +101,11 @@ CMD ["bash", "./start_prod_server.sh"]
|
|||||||
|
|
||||||
FROM base as dev
|
FROM base as dev
|
||||||
|
|
||||||
# The development image requires the source code to be mounted to /home/inventree/src/
|
# The development image requires the source code to be mounted to /home/inventree/
|
||||||
# So from here, we don't actually "do" anything
|
# So from here, we don't actually "do" anything, apart from some file management
|
||||||
|
|
||||||
WORKDIR ${INVENTREE_SRC_DIR}
|
ENV INVENTREE_DEV_DIR = "${INVENTREE_HOME}/dev"
|
||||||
|
|
||||||
COPY start_dev_server.sh ${INVENTREE_HOME}/start_dev_server.sh
|
WORKDIR ${INVENTREE_HOME}
|
||||||
COPY start_dev_worker.sh ${INVENTREE_HOME}/start_dev_worker.sh
|
|
||||||
RUN chmod 755 ${INVENTREE_HOME}/start_dev_server.sh
|
|
||||||
RUN chmod 755 ${INVENTREE_HOME}/start_dev_worker.sh
|
|
||||||
|
|
||||||
CMD ["bash", "/home/inventree/start_dev_server.sh"]
|
CMD ["bash", "/home/inventree/docker/start_dev_server.sh"]
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
INVENTREE_DB_ENGINE=sqlite3
|
INVENTREE_DB_ENGINE=sqlite3
|
||||||
INVENTREE_DB_NAME=/home/inventree/src/inventree_docker_dev.sqlite3
|
INVENTREE_DB_NAME=/home/inventree/dev/inventree_db.sqlite3
|
||||||
INVENTREE_MEDIA_ROOT=/home/inventree/src/inventree_media
|
INVENTREE_MEDIA_ROOT=/home/inventree/dev/media
|
||||||
INVENTREE_STATIC_ROOT=/home/inventree/src/inventree_static
|
INVENTREE_STATIC_ROOT=/home/inventree/dev/static
|
||||||
INVENTREE_CONFIG_FILE=/home/inventree/src/config.yaml
|
INVENTREE_CONFIG_FILE=/home/inventree/dev/config.yaml
|
||||||
INVENTREE_SECRET_KEY_FILE=/home/inventree/src/secret_key.txt
|
INVENTREE_SECRET_KEY_FILE=/home/inventree/dev/secret_key.txt
|
||||||
INVENTREE_DEBUG=true
|
INVENTREE_DEBUG=true
|
||||||
|
INVENTREE_WEB_ADDR=127.0.0.1
|
||||||
|
INVENTREE_WEB_PORT=8000
|
@ -13,8 +13,8 @@ version: "3.8"
|
|||||||
services:
|
services:
|
||||||
# InvenTree web server services
|
# InvenTree web server services
|
||||||
# Uses gunicorn as the web server
|
# Uses gunicorn as the web server
|
||||||
inventree-server:
|
inventree-dev-server:
|
||||||
container_name: inventree-server
|
container_name: inventree-dev-server
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
target: dev
|
target: dev
|
||||||
@ -22,7 +22,7 @@ services:
|
|||||||
- 8000:8000
|
- 8000:8000
|
||||||
volumes:
|
volumes:
|
||||||
# Ensure you specify the location of the 'src' directory at the end of this file
|
# Ensure you specify the location of the 'src' directory at the end of this file
|
||||||
- src:/home/inventree/src
|
- src:/home/inventree
|
||||||
env_file:
|
env_file:
|
||||||
# Environment variables required for the dev server are configured in dev-config.env
|
# Environment variables required for the dev server are configured in dev-config.env
|
||||||
- dev-config.env
|
- dev-config.env
|
||||||
@ -30,17 +30,17 @@ services:
|
|||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
# Background worker process handles long-running or periodic tasks
|
# Background worker process handles long-running or periodic tasks
|
||||||
inventree-worker:
|
inventree-dev-worker:
|
||||||
container_name: inventree-worker
|
container_name: inventree-dev-worker
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
target: dev
|
target: dev
|
||||||
entrypoint: /home/inventree/start_dev_worker.sh
|
entrypoint: /home/inventree/docker/start_dev_worker.sh
|
||||||
depends_on:
|
depends_on:
|
||||||
- inventree-server
|
- inventree-dev-server
|
||||||
volumes:
|
volumes:
|
||||||
# Ensure you specify the location of the 'src' directory at the end of this file
|
# Ensure you specify the location of the 'src' directory at the end of this file
|
||||||
- src:/home/inventree/src
|
- src:/home/inventree
|
||||||
env_file:
|
env_file:
|
||||||
# Environment variables required for the dev server are configured in dev-config.env
|
# Environment variables required for the dev server are configured in dev-config.env
|
||||||
- dev-config.env
|
- dev-config.env
|
||||||
@ -55,5 +55,5 @@ volumes:
|
|||||||
type: none
|
type: none
|
||||||
o: bind
|
o: bind
|
||||||
# This directory specified where InvenTree source code is stored "outside" the docker containers
|
# This directory specified where InvenTree source code is stored "outside" the docker containers
|
||||||
# Note: This directory must conatin the file *manage.py*
|
# By default, this directory is one level above the "docker" directory
|
||||||
device: /path/to/inventree/src
|
device: ../
|
||||||
|
@ -16,21 +16,22 @@ if test -f "$INVENTREE_CONFIG_FILE"; then
|
|||||||
echo "$INVENTREE_CONFIG_FILE exists - skipping"
|
echo "$INVENTREE_CONFIG_FILE exists - skipping"
|
||||||
else
|
else
|
||||||
echo "Copying config file to $INVENTREE_CONFIG_FILE"
|
echo "Copying config file to $INVENTREE_CONFIG_FILE"
|
||||||
cp $INVENTREE_SRC_DIR/InvenTree/config_template.yaml $INVENTREE_CONFIG_FILE
|
cp $INVENTREE_HOME/InvenTree/config_template.yaml $INVENTREE_CONFIG_FILE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Setup a virtual environment
|
# Setup a virtual environment (within the "dev" directory)
|
||||||
python3 -m venv inventree-docker-dev
|
python3 -m venv ./dev/env
|
||||||
|
|
||||||
source inventree-docker-dev/bin/activate
|
# Activate the virtual environment
|
||||||
|
source ./dev/env/bin/activate
|
||||||
|
|
||||||
echo "Installing required packages..."
|
echo "Installing required packages..."
|
||||||
pip install --no-cache-dir -U -r ${INVENTREE_SRC_DIR}/requirements.txt
|
pip install --no-cache-dir -U -r ${INVENTREE_HOME}/requirements.txt
|
||||||
|
|
||||||
echo "Starting InvenTree server..."
|
echo "Starting InvenTree server..."
|
||||||
|
|
||||||
# Wait for the database to be ready
|
# Wait for the database to be ready
|
||||||
cd $INVENTREE_MNG_DIR
|
cd ${INVENTREE_HOME}/InvenTree
|
||||||
python manage.py wait_for_db
|
python manage.py wait_for_db
|
||||||
|
|
||||||
sleep 10
|
sleep 10
|
||||||
@ -45,4 +46,4 @@ python manage.py migrate --run-syncdb || exit 1
|
|||||||
python manage.py clearsessions || exit 1
|
python manage.py clearsessions || exit 1
|
||||||
|
|
||||||
# Launch a development server
|
# Launch a development server
|
||||||
python manage.py runserver 0.0.0.0:$INVENTREE_WEB_PORT
|
python manage.py runserver ${INVENTREE_WEB_ADDR}:${INVENTREE_WEB_PORT}
|
||||||
|
@ -2,15 +2,15 @@
|
|||||||
|
|
||||||
echo "Starting InvenTree worker..."
|
echo "Starting InvenTree worker..."
|
||||||
|
|
||||||
cd $INVENTREE_SRC_DIR
|
cd $INVENTREE_HOME
|
||||||
|
|
||||||
# Activate virtual environment
|
# Activate virtual environment
|
||||||
source inventree-docker-dev/bin/activate
|
source ./dev/env/bin/activate
|
||||||
|
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|
||||||
# Wait for the database to be ready
|
# Wait for the database to be ready
|
||||||
cd $INVENTREE_MNG_DIR
|
cd InvenTree
|
||||||
python manage.py wait_for_db
|
python manage.py wait_for_db
|
||||||
|
|
||||||
sleep 10
|
sleep 10
|
||||||
|
Loading…
Reference in New Issue
Block a user