mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-16 03:55:41 +00:00
Separate Dockerfile for devcontainer
- Debian based (python3.11-bookworm) - Install essential system packages
This commit is contained in:
30
.devcontainer/Dockerfile
Normal file
30
.devcontainer/Dockerfile
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
# Dockerfile for the InvenTree devcontainer
|
||||||
|
|
||||||
|
# In contrast with the "production" image (which is based on an Alpine image)
|
||||||
|
# we use a Debian-based image for the devcontainer
|
||||||
|
|
||||||
|
FROM mcr.microsoft.com/devcontainers/python:3.11-bookworm
|
||||||
|
|
||||||
|
# InvenTree paths
|
||||||
|
ENV INVENTREE_HOME="/home/inventree"
|
||||||
|
ENV INVENTREE_DATA_DIR="${INVENTREE_HOME}/dev"
|
||||||
|
ENV INVENTREE_STATIC_ROOT="${INVENTREE_DATA_DIR}/static"
|
||||||
|
ENV INVENTREE_MEDIA_ROOT="${INVENTREE_DATA_DIR}/media"
|
||||||
|
ENV INVENTREE_BACKUP_DIR="${INVENTREE_DATA_DIR}/backup"
|
||||||
|
ENV INVENTREE_PLUGIN_DIR="${INVENTREE_DATA_DIR}/plugins"
|
||||||
|
|
||||||
|
ENV INVENTREE_DOCKER="true"
|
||||||
|
|
||||||
|
COPY contrib/container/init.sh ./
|
||||||
|
RUN chmod +x init.sh
|
||||||
|
|
||||||
|
# Install required base packages
|
||||||
|
RUN apt update && apt install -y \
|
||||||
|
python3.11-dev python3.11-venv \
|
||||||
|
libldap2-dev libsasl2-dev \
|
||||||
|
libpango1.0-0 libcairo2 \
|
||||||
|
weasyprint
|
||||||
|
|
||||||
|
# Install python database connectors
|
||||||
|
|
||||||
|
ENTRYPOINT ["/bin/bash", "./init.sh"]
|
@ -20,11 +20,7 @@ services:
|
|||||||
inventree:
|
inventree:
|
||||||
build:
|
build:
|
||||||
context: ..
|
context: ..
|
||||||
dockerfile: ../InvenTree/contrib/container/Dockerfile
|
dockerfile: .devcontainer/Dockerfile
|
||||||
target: dev
|
|
||||||
args:
|
|
||||||
base_image: "mcr.microsoft.com/vscode/devcontainers/base:alpine-3.18"
|
|
||||||
data_dir: "dev"
|
|
||||||
volumes:
|
volumes:
|
||||||
- ../:/home/inventree:z
|
- ../:/home/inventree:z
|
||||||
|
|
||||||
|
@ -8,7 +8,10 @@ python3 -m venv /home/inventree/dev/venv --system-site-packages --upgrade-deps
|
|||||||
. /home/inventree/dev/venv/bin/activate
|
. /home/inventree/dev/venv/bin/activate
|
||||||
|
|
||||||
# Ensure the correct invoke is available
|
# Ensure the correct invoke is available
|
||||||
pip3 install invoke --ignore-installed -U
|
pip3 install --ignore-installed --upgrade invoke Pillow
|
||||||
|
|
||||||
|
# install base level packages
|
||||||
|
pip3 install -Ur contrib/container/requirements.txt
|
||||||
|
|
||||||
# Run initial InvenTree server setup
|
# Run initial InvenTree server setup
|
||||||
invoke update -s
|
invoke update -s
|
||||||
@ -23,3 +26,8 @@ invoke int.frontend-install
|
|||||||
# so that it gets copied from host to the container to have your global
|
# so that it gets copied from host to the container to have your global
|
||||||
# git config in container
|
# git config in container
|
||||||
rm -f /home/vscode/.gitconfig
|
rm -f /home/vscode/.gitconfig
|
||||||
|
|
||||||
|
# Fix issue related to CFFI version mismatch
|
||||||
|
pip uninstall cffi -y
|
||||||
|
sudo apt remove --purge python3-cffi
|
||||||
|
pip install --no-cache-dir --force-reinstall --ignore-installed cffi
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
# - Runs InvenTree web server under django development server
|
# - Runs InvenTree web server under django development server
|
||||||
# - Monitors source files for any changes, and live-reloads server
|
# - Monitors source files for any changes, and live-reloads server
|
||||||
|
|
||||||
ARG base_image=python:3.11-alpine3.21
|
FROM python:3.11-alpine3.21 AS inventree_base
|
||||||
FROM ${base_image} AS inventree_base
|
|
||||||
ARG base_image
|
ARG base_image
|
||||||
|
|
||||||
# Build arguments for this image
|
# Build arguments for this image
|
||||||
|
@ -36,7 +36,7 @@ services:
|
|||||||
# Database service
|
# Database service
|
||||||
# Use PostgreSQL as the database backend
|
# Use PostgreSQL as the database backend
|
||||||
inventree-db:
|
inventree-db:
|
||||||
image: postgres:16
|
image: postgres:17
|
||||||
container_name: inventree-db
|
container_name: inventree-db
|
||||||
expose:
|
expose:
|
||||||
- ${INVENTREE_DB_PORT:-5432}/tcp
|
- ${INVENTREE_DB_PORT:-5432}/tcp
|
||||||
|
@ -285,7 +285,7 @@ extra:
|
|||||||
min_python_version: 3.9
|
min_python_version: 3.9
|
||||||
min_invoke_version: 2.0.0
|
min_invoke_version: 2.0.0
|
||||||
django_version: 4.2
|
django_version: 4.2
|
||||||
docker_postgres_version: 16
|
docker_postgres_version: 17
|
||||||
|
|
||||||
version:
|
version:
|
||||||
default: stable
|
default: stable
|
||||||
|
Reference in New Issue
Block a user