diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b3353b06..be39766a 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -5,14 +5,11 @@ // Features to add to the dev container. More info: https://containers.dev/features. // "features": {}, - // Use 'forwardPorts' to make a list of ports inside the container available locally. - // "forwardPorts": [], - - // Use 'postCreateCommand' to run commands after the container is created. + // Runs the initial setup commands after the container is created. "postCreateCommand": ".devcontainer/post-create-command.sh" - // Use 'postStartCommand' to run commands after the container is started. - // "postStartCommand": ". .venv/bin/activate", + // Activates the virtual environment after the container is started. + // "postStartCommand": ". .venv/bin/activate" // Configure tool-specific properties. // "customizations": {}, diff --git a/.devcontainer/post-create-command.sh b/.devcontainer/post-create-command.sh index e69de29b..98c5fd4b 100644 --- a/.devcontainer/post-create-command.sh +++ b/.devcontainer/post-create-command.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# Add user's fork as a remote +GIT_USER=$(git config user.name) +git remote add fork https://github.com/${GIT_USER}/flask + +# Create and activate a virtualenv +python3 -m venv .venv +. .venv/bin/activate + +# Upgrade pip and setuptools +python -m pip install --upgrade pip setuptools + +# Install the development dependencies, then install Flask in editable mode +pip install -r requirements/dev.txt && pip install -e . + +# Install pre-commit hooks +pre-commit install + +# Install coverage +pip install coverage