mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-31 13:15:43 +00:00 
			
		
		
		
	Docker postgres fix (#9041)
* Update docker image
- Move from alpine 3.19 to alpine 3.21
- Move from postgres13_client to postgres17_client
* Update docker-compose file
- Move from postgres:13 to postgres:16
- Move from redis:7.0 to redis:7-alpine
* Update docs
* Update docker docs
* Separate Dockerfile for devcontainer
- Debian based (python3.11-bookworm)
- Install essential system packages
* Instal postgres client
* Further devcontainer updates
- Bump postgresql image from 13 to 15
- Store psql data in the dev/psql directory
- Install required frontend packages
* Use --host mode for frontend server
* Tweak devcontainer docs
* Bump pre commit config file
* Revert "Bump pre commit config file"
This reverts commit bbfd875ac8.
			
			
This commit is contained in:
		
							
								
								
									
										36
									
								
								.devcontainer/Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								.devcontainer/Dockerfile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,36 @@ | ||||
| # 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_CONFIG_FILE="${INVENTREE_DATA_DIR}/config.yaml" | ||||
|  | ||||
| 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 \ | ||||
|    postgresql-client \ | ||||
|    libldap2-dev libsasl2-dev \ | ||||
|    libpango1.0-0 libcairo2 \ | ||||
|    weasyprint | ||||
|  | ||||
| # Install packages required for frontend development | ||||
| RUN apt install -y \ | ||||
|    yarn nodejs npm | ||||
|  | ||||
| RUN yarn config set network-timeout 600000 -g | ||||
|  | ||||
| # Install python database connectors | ||||
|  | ||||
| ENTRYPOINT ["/bin/bash", "./init.sh"] | ||||
| @@ -1,11 +1,11 @@ | ||||
| services: | ||||
|   db: | ||||
|     image: postgres:13 | ||||
|     image: postgres:15 | ||||
|     restart: unless-stopped | ||||
|     expose: | ||||
|       - 5432/tcp | ||||
|     volumes: | ||||
|       - inventreedatabase:/var/lib/postgresql/data:z | ||||
|       - ../dev/psql/:/var/lib/postgresql/data:z | ||||
|     environment: | ||||
|       POSTGRES_DB: inventree | ||||
|       POSTGRES_USER: inventree_user | ||||
| @@ -20,11 +20,7 @@ services: | ||||
|   inventree: | ||||
|     build: | ||||
|       context: .. | ||||
|       dockerfile: ../InvenTree/contrib/container/Dockerfile | ||||
|       target: dev | ||||
|       args: | ||||
|         base_image: "mcr.microsoft.com/vscode/devcontainers/base:alpine-3.18" | ||||
|         data_dir: "dev" | ||||
|       dockerfile: .devcontainer/Dockerfile | ||||
|     volumes: | ||||
|       - ../:/home/inventree:z | ||||
|  | ||||
| @@ -44,6 +40,3 @@ services: | ||||
|  | ||||
|     depends_on: | ||||
|       - db | ||||
|  | ||||
| volumes: | ||||
|   inventreedatabase: | ||||
|   | ||||
| @@ -7,8 +7,24 @@ git config --global --add safe.directory /home/inventree | ||||
| python3 -m venv /home/inventree/dev/venv --system-site-packages --upgrade-deps | ||||
| . /home/inventree/dev/venv/bin/activate | ||||
|  | ||||
| # remove existing gitconfig created by "Avoiding Dubious Ownership" step | ||||
| # so that it gets copied from host to the container to have your global | ||||
| # git config in container | ||||
| rm -f /home/vscode/.gitconfig | ||||
|  | ||||
| # Fix issue related to CFFI version mismatch | ||||
| pip uninstall cffi -y | ||||
| sudo apt remove --purge -y python3-cffi | ||||
| pip install --no-cache-dir --force-reinstall --ignore-installed cffi | ||||
|  | ||||
| # Upgrade pip | ||||
| python3 -m pip install --upgrade pip | ||||
|  | ||||
| # 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 | ||||
| invoke update -s | ||||
| @@ -19,7 +35,5 @@ invoke dev.setup-dev | ||||
| # Install required frontend packages | ||||
| invoke int.frontend-install | ||||
|  | ||||
| # remove existing gitconfig created by "Avoiding Dubious Ownership" step | ||||
| # so that it gets copied from host to the container to have your global | ||||
| # git config in container | ||||
| rm -f /home/vscode/.gitconfig | ||||
| # Install playwright dependencies | ||||
| cd src/frontend && sudo npx playwright install-deps | ||||
|   | ||||
		Reference in New Issue
	
	Block a user