diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index c83246b6..8570e260 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -13,7 +13,5 @@ } } }, - // "onCreateCommand": "sudo cp .devcontainer/welcome-message.txt /usr/local/etc/vscode-dev-containers/first-run-notice.txt", - "postCreateCommand": "sudo chmod +x .devcontainer/post-create-command.sh && .devcontainer/post-create-command.sh", - "waitFor": "postCreateCommand" + "onCreateCommand": "sudo chmod +x .devcontainer/on-create-command.sh && .devcontainer/on-create-command.sh" } diff --git a/.devcontainer/on-create-command.sh b/.devcontainer/on-create-command.sh new file mode 100755 index 00000000..148ddf22 --- /dev/null +++ b/.devcontainer/on-create-command.sh @@ -0,0 +1,14 @@ +#!/bin/bash +set -e + +if ! git remote | grep -q "fork"; then + git remote add fork https://github.com/${GITHUB_USER}/flask +fi + +python3 -m venv .venv +. .venv/bin/activate +pip install --upgrade pip setuptools +pip install -r requirements/dev.txt && pip install -e . +pre-commit install + +sudo cp .devcontainer/welcome-message.txt /usr/local/etc/vscode-dev-containers/first-run-notice.txt