Skip to content

Commit

Permalink
Add VSCode/Codespaces Dev Container settings (#687)
Browse files Browse the repository at this point in the history
### Description
This adds `.devcontainer/devcontainer.json` so that VSCode will
automatically download and start a Docker container and load a
development environment for Quokka inside this container.

For more information, see:
https://code.visualstudio.com/docs/devcontainers/containers#_quick-start-open-a-git-repository-or-github-pr-in-an-isolated-container-volume.

This will also enable GitHub Codespaces:
https://docs.github.com/en/codespaces/overview#what-is-a-codespace.

### Related issues
N/A

### Checklist
_Before this pull request can be reviewed, all of these tasks should be
completed. Denote completed tasks with an `x` inside the square brackets
`[ ]` in the Markdown source below:_
- [x] I have added a description (see above).
- [ ] I have added a link to any related issues see (see above).
- [x] I have read the [Contributing
Guide](https://github.com/quokka-astro/quokka/blob/development/CONTRIBUTING.md).
- [ ] I have added tests for any new physics that this PR adds to the
code.
- [ ] I have tested this PR on my local computer and all tests pass.
- [ ] I have manually triggered the GPU tests with the magic comment
`/azp run`.
- [x] I have requested a reviewer for this PR.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
BenWibking and pre-commit-ci[bot] authored Jul 28, 2024
1 parent 78894d5 commit 514e5a7
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM mcr.microsoft.com/devcontainers/cpp:ubuntu-24.04

RUN apt-get --yes -qq update \
&& apt-get --yes -qq upgrade \
&& apt-get --yes -qq install build-essential \
git cmake clangd gcc g++ \
python3-dev python3-numpy python3-matplotlib python3-pip \
sphinx-doc python3-sphinx-rtd-theme python3-sphinxcontrib.bibtex python3-sphinx-copybutton \
libopenmpi-dev \
libhdf5-mpi-dev \
&& apt-get --yes -qq clean \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /home/ubuntu
USER ubuntu

# install esbonio for Sphinx VSCode support (no Ubuntu package for this)
RUN pip install esbonio --break-system-packages

# workaround Python babel bug
ENV TZ=UTC

CMD [ "/bin/bash" ]
35 changes: 35 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// devcontainer.json
{
"name": "quokka-dev",
// (NOTE: using the cloud image is temporarily disabled, since it doesn't exist yet)
// "image": "ghcr.io/quokka-astro/quokka:development",
"build": {
// Path is relative to the devcontainer.json file.
"dockerfile": "Dockerfile"
},
"hostRequirements": {
"cpus": 4
},
"customizations": {
"vscode": {
"settings": {},
"extensions": [
// disabled, since it interferes with clangd
"-ms-vscode.cpptools",
"llvm-vs-code-extensions.vscode-clangd",
"github.vscode-pull-request-github",
"ms-python.python",
"ms-toolsai.jupyter",
"ms-vscode.live-server",
"ms-azuretools.vscode-docker",
"swyddfa.esbonio",
"tomoki1207.pdf" // this extension does not work on codespaces
]
}
},
"remoteUser": "ubuntu",
// we need to manually checkout the submodules,
// but VSCode may try to configure CMake before they are fully checked-out.
// workaround TBD
"postCreateCommand": "git submodule update --init"
}

0 comments on commit 514e5a7

Please sign in to comment.