Skip to content

Commit

Permalink
Provide devcontainer configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
jellybob committed Dec 14, 2023
1 parent ce4f520 commit 4157660
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
17 changes: 16 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@
"dockerComposeFile": "../docker-compose.yml",
"service": "app",
"workspaceFolder": "/app",
"containerEnv": {
"EDITOR": "code -w"
},
// Replace the standard command with a noop to allow exec-ing
"overrideCommand": true,
// Git complains if user IDs don't match, which they will with a mounted directory
"onCreateCommand": "git config --global --add safe.directory /app",
// Port forwarding
"forwardPorts": [
2342,
Expand All @@ -26,6 +31,16 @@
// VSCode additions
"features": {},
"customizations": {
"vscode": {}
"vscode": {
"extensions": [
"dbaeumer.vscode-eslint",
"EditorConfig.EditorConfig",
"github.vscode-github-actions",
"ms-python.python",
"ms-python.black-formatter",
"ms-python.flake8",
"ms-python.mypy-type-checker"
]
}
}
}
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,23 @@ To delete all data and start over fresh you can use `docker compose down`.
Management commands can be listed and run using the `./flask` command, which
forwards them to the flask command line within the container.

### Visual Studio Code

If you use Visual Studio Code it should present you with the option to open the
project in a dev container. If not, run `code .` from your local copy, and ensure
you have the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) installed.

Reopening in a dev container will start everything via Docker, attach
your VSCode instance to the application container, install relevant extensions,
and ensure everything is configured to fit with our standards.

The first time you start the dev container you will need to tell VSCode where to
find the Poetry virtual environment. You can do this by open the command pallette
(Cmd-P on macOS devices) and searching for "Python: Select interpreter", the list
presented should include `website-${randomHash}-py3.11`, which will be annotated
as "Poetry". Select that, and then any Python tooling and shells will run within
the appropriate virtualenv.

### Errors starting the dev server

e.g. `Error: While importing 'dev_server', an ImportError was raised.`
Expand Down

0 comments on commit 4157660

Please sign in to comment.