InvenTree/.devcontainer/postCreateCommand.sh
Oliver f96055a33f
Refactor docker image for devcontainer (#6029)
* Make base image configurable

* Refactor dockerfile

- Place extra packages into extra shell script
- Add pre-build stage where packages are installed, and then cache removed
- Run same script in dev target, but do not remove

* Run docker workflow whenever package requirements change

* Replace devcontainer dockerfile

* Install base packages in devcontainer

* --no-cache-dir
2023-12-05 07:05:48 +11:00

25 lines
658 B
Bash
Executable File

#!/bin/bash
# Avoiding Dubious Ownership in Dev Containers for setup commands that use git
# Note that the local workspace directory is passed through as the first argument $1
git config --global --add safe.directory $1
# create folders
mkdir -p $1/dev/{commandhistory,plugins}
cd $1
# create venv
python3 -m venv $1/dev/venv
. $1/dev/venv/bin/activate
# setup InvenTree server
pip install invoke
invoke update
invoke setup-dev
invoke 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