From df82c4916c69ef8dee0a23e3764ca67c9613660f Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 11 Feb 2025 09:02:38 +0000 Subject: [PATCH] Further devcontainer updates - Bump postgresql image from 13 to 15 - Store psql data in the dev/psql directory - Install required frontend packages --- .devcontainer/Dockerfile | 9 +++++++-- .devcontainer/docker-compose.yml | 7 ++----- .devcontainer/postCreateCommand.sh | 27 +++++++++++++++------------ 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index af09987f2d..49ed779532 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -12,8 +12,7 @@ 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" +ENV INVENTREE_CONFIG_FILE="${INVENTREE_DATA_DIR}/config.yaml" COPY contrib/container/init.sh ./ RUN chmod +x init.sh @@ -26,6 +25,12 @@ RUN apt update && apt install -y \ 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"] diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index 51c4b1e7b9..659f102869 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -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 @@ -40,6 +40,3 @@ services: depends_on: - db - -volumes: - inventreedatabase: diff --git a/.devcontainer/postCreateCommand.sh b/.devcontainer/postCreateCommand.sh index 6c662cb7e9..8ae901a812 100755 --- a/.devcontainer/postCreateCommand.sh +++ b/.devcontainer/postCreateCommand.sh @@ -7,6 +7,19 @@ 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 --ignore-installed --upgrade invoke Pillow @@ -22,15 +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 - -# 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 \ No newline at end of file +# Install playwright dependencies +cd src/frontend && sudo npx playwright install-deps