mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Development docker image
- Uses multistage build - Adds a docker compose file for dev
This commit is contained in:
parent
d301794516
commit
914db9e913
1
.github/workflows/docker_build.yaml
vendored
1
.github/workflows/docker_build.yaml
vendored
@ -30,6 +30,7 @@ jobs:
|
||||
context: ./docker
|
||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||
push: true
|
||||
target: production
|
||||
repository: inventree/inventree
|
||||
tags: inventree/inventree:latest
|
||||
- name: Image Digest
|
||||
|
1
.github/workflows/docker_publish.yaml
vendored
1
.github/workflows/docker_publish.yaml
vendored
@ -28,4 +28,5 @@ jobs:
|
||||
repository: inventree/inventree
|
||||
tag_with_ref: true
|
||||
dockerfile: ./Dockerfile
|
||||
target: production
|
||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||
|
@ -1,4 +1,4 @@
|
||||
FROM python:alpine as production
|
||||
FROM python:alpine as base
|
||||
|
||||
# GitHub source
|
||||
ARG repository="https://github.com/inventree/InvenTree.git"
|
||||
@ -73,6 +73,7 @@ RUN pip install --no-cache-dir -U invoke
|
||||
RUN pip install --no-cache-dir -U psycopg2 mysqlclient pgcli mariadb
|
||||
RUN pip install --no-cache-dir -U gunicorn
|
||||
|
||||
FROM base as production
|
||||
# Clone source code
|
||||
RUN echo "Downloading InvenTree from ${INVENTREE_REPO}"
|
||||
RUN git clone --branch ${INVENTREE_BRANCH} --depth 1 ${INVENTREE_REPO} ${INVENTREE_SRC_DIR}
|
||||
@ -97,3 +98,9 @@ WORKDIR ${INVENTREE_SRC_DIR}
|
||||
|
||||
# Let us begin
|
||||
CMD ["bash", "./start_prod_server.sh"]
|
||||
|
||||
FROM base as dev
|
||||
# The development image requires the source code to be mounted to /home/inventree/src/
|
||||
# So from here, we don't actually "do" anything
|
||||
|
||||
WORKDIR ${INVENTREE_SRC_DIR}
|
||||
|
70
docker/docker-compose.dev.yml
Normal file
70
docker/docker-compose.dev.yml
Normal file
@ -0,0 +1,70 @@
|
||||
version: "3.8"
|
||||
|
||||
# Docker compose recipe for InvenTree development server
|
||||
# - Runs sqlite3 as the database backend
|
||||
# - Uses built-in 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-server:
|
||||
container_name: inventree-server
|
||||
image: inventree/inventree:latest
|
||||
entrypoint: ./start_dev_server.sh
|
||||
ports:
|
||||
- 8000
|
||||
depends_on:
|
||||
- inventree-db
|
||||
volumes:
|
||||
# Ensure you specify the location of the 'src' directory at the end of this file
|
||||
- src:/home/inventree/src
|
||||
- data:/home/inventree/data
|
||||
- static:/home/inventree/static
|
||||
environment:
|
||||
# Configure a simple sqlite server for development
|
||||
# Note: You can always change to a different database backend if required!
|
||||
- INVENTREE_DB_ENGINE=sqlite
|
||||
- INVENTREE_DB_NAME=inventree
|
||||
restart: unless-stopped
|
||||
|
||||
# Background worker process handles long-running or periodic tasks
|
||||
inventree-worker:
|
||||
container_name: inventree-worker
|
||||
image: inventree/inventree:latest
|
||||
entrypoint: ./start_worker.sh
|
||||
depends_on:
|
||||
- inventree-db
|
||||
- inventree-server
|
||||
volumes:
|
||||
# Ensure you specify the location of the 'src' directory at the end of this file
|
||||
- data:/home/inventree/data
|
||||
- static:/home/inventree/static
|
||||
environment:
|
||||
# Configure a simple sqlite server for development
|
||||
# Note: You can always change to a different database backend if required!
|
||||
- INVENTREE_DB_ENGINE=sqlite
|
||||
- INVENTREE_DB_NAME=inventree
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
# NOTE: Change /path/to/src to a directory on your local machine, where the InvenTree source code is located
|
||||
# This directory must conatin the file *manage.py*
|
||||
# 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
|
||||
# Note: This directory must conatin the file *manage.py*
|
||||
device: /path/to/src
|
||||
# Uploaded data / media files, shared between containers
|
||||
data:
|
||||
# Static files, shared between containers
|
||||
static:
|
Loading…
Reference in New Issue
Block a user