Skip to content

Commit

Permalink
Add dev containers for all of our images
Browse files Browse the repository at this point in the history
  • Loading branch information
knelli2 committed Mar 15, 2024
1 parent 348ab00 commit 2a72e96
Show file tree
Hide file tree
Showing 6 changed files with 141 additions and 11 deletions.
41 changes: 41 additions & 0 deletions .devcontainer/ci/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "SpECTRE GitHub CI environment",
"image": "sxscollaboration/spectre:ci",
"workspaceMount": "source=${localWorkspaceFolder},target=${localWorkspaceFolder},type=bind,consistency=delegated",
"workspaceFolder": "${localWorkspaceFolder}",
"customizations": {
"vscode": {
"extensions": [
"eamodio.gitlens",
"foxundermoon.shell-format",
"github.vscode-pull-request-github",
"gruntfuggly.format-modified",
"ms-python.black-formatter",
"ms-python.python",
"ms-vscode.cmake-tools",
"ms-vscode.cpptools",
"ms-vsliveshare.vsliveshare",
"redhat.vscode-yaml",
"stkb.rewrap",
"streetsidesoftware.code-spell-checker",
"twxs.cmake"
],
"settings": {
"cmake.buildDirectory": "${localWorkspaceFolder}/build-${buildKit}-${buildType}",
"editor.rulers": [80],
"editor.wordWrap": "off",
"editor.formatOnSave": false,
"editor.formatOnPaste": true,
"editor.formatOnType": true,
"python.pythonPath": "/usr/bin/python3",
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
}
}
}
},
"remoteEnv": {
"SPECTRE_HOME": "${localWorkspaceFolder}"
},
"postCreateCommand": "git config --global --add safe.directory ${localWorkspaceFolder} && mkdir -p /root/.local/share/CMakeTools && cp ${localWorkspaceFolder}/.devcontainer/cmake-kits.json /root/.local/share/CMakeTools/cmake-tools-kits.json"
}
41 changes: 41 additions & 0 deletions .devcontainer/demo/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "SpECTRE demo environment",
"image": "sxscollaboration/spectre:demo",
"workspaceMount": "source=${localWorkspaceFolder},target=${localWorkspaceFolder},type=bind,consistency=delegated",
"workspaceFolder": "${localWorkspaceFolder}",
"customizations": {
"vscode": {
"extensions": [
"eamodio.gitlens",
"foxundermoon.shell-format",
"github.vscode-pull-request-github",
"gruntfuggly.format-modified",
"ms-python.black-formatter",
"ms-python.python",
"ms-vscode.cmake-tools",
"ms-vscode.cpptools",
"ms-vsliveshare.vsliveshare",
"redhat.vscode-yaml",
"stkb.rewrap",
"streetsidesoftware.code-spell-checker",
"twxs.cmake"
],
"settings": {
"cmake.buildDirectory": "${localWorkspaceFolder}/build-${buildKit}-${buildType}",
"editor.rulers": [80],
"editor.wordWrap": "off",
"editor.formatOnSave": false,
"editor.formatOnPaste": true,
"editor.formatOnType": true,
"python.pythonPath": "/usr/bin/python3",
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
}
}
}
},
"remoteEnv": {
"SPECTRE_HOME": "${localWorkspaceFolder}"
},
"postCreateCommand": "git config --global --add safe.directory ${localWorkspaceFolder} && mkdir -p /root/.local/share/CMakeTools && cp ${localWorkspaceFolder}/.devcontainer/cmake-kits.json /root/.local/share/CMakeTools/cmake-tools-kits.json"
}
41 changes: 41 additions & 0 deletions .devcontainer/deploy/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "SpECTRE deploy environment",
"image": "sxscollaboration/spectre:deploy",
"workspaceMount": "source=${localWorkspaceFolder},target=${localWorkspaceFolder},type=bind,consistency=delegated",
"workspaceFolder": "${localWorkspaceFolder}",
"customizations": {
"vscode": {
"extensions": [
"eamodio.gitlens",
"foxundermoon.shell-format",
"github.vscode-pull-request-github",
"gruntfuggly.format-modified",
"ms-python.black-formatter",
"ms-python.python",
"ms-vscode.cmake-tools",
"ms-vscode.cpptools",
"ms-vsliveshare.vsliveshare",
"redhat.vscode-yaml",
"stkb.rewrap",
"streetsidesoftware.code-spell-checker",
"twxs.cmake"
],
"settings": {
"cmake.buildDirectory": "${localWorkspaceFolder}/build-${buildKit}-${buildType}",
"editor.rulers": [80],
"editor.wordWrap": "off",
"editor.formatOnSave": false,
"editor.formatOnPaste": true,
"editor.formatOnType": true,
"python.pythonPath": "/usr/bin/python3",
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
}
}
}
},
"remoteEnv": {
"SPECTRE_HOME": "${localWorkspaceFolder}"
},
"postCreateCommand": "git config --global --add safe.directory ${localWorkspaceFolder} && mkdir -p /root/.local/share/CMakeTools && cp ${localWorkspaceFolder}/.devcontainer/cmake-kits.json /root/.local/share/CMakeTools/cmake-tools-kits.json"
}
File renamed without changes.
24 changes: 16 additions & 8 deletions docs/DevGuide/QuickStartDockerVSCode.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,11 @@ example `Preferences: Open User Settings`.
## Reopen the SpECTRE repository in the development container

Open the command palette by hitting `Cmd+Shift+P` (macOS) or `Ctrl+Shift+P`
(Linux or Windows) and run the command `Remote-Containers: Reopen in container`
by starting to type a few letters of this command and then hitting `Enter`.
(Linux or Windows) and run the command `Dev Containers: Reopen in container`
by starting to type a few letters of this command and then hitting `Enter`. You
should be prompted with a few different containers to choose from. Select the
one named `SpECTRE development environment`. This will give you a minimally
working SpECTRE environment for development.

Visual Studio Code will download and run the container and drop you into a fully
configured environment where you can proceed to compile and run SpECTRE. This
Expand All @@ -116,15 +119,20 @@ of the download.

If you are interested to learn more about how this feature works you can
read through the [VS Code documentation on remote containers](https://code.visualstudio.com/docs/remote/containers)
and inspect the `.devcontainer/devcontainer.json` file that's included in the
SpECTRE repository.
and inspect the `.devcontainer/dev/devcontainer.json` file that's included in
the SpECTRE repository.

\note If you look into the `.devcontainer/devcontainer.json` file, you'll see we
\note If you look into the `.devcontainer/dev/devcontainer.json` file,
you'll see we
are using the `sxscollaboration/spectre:dev` container. We also offer other
containers. The `sxscollaboration/spectre:ci` container has more compilers and
containers. The `.devcontainer/ci/devcontainer.json` file uses the
`sxscollaboration/spectre:ci` container and has more compilers. The
`.devcontainer/demo/devcontainer.json` file uses
the `sxscollaboration/spectre:demo` container has a couple pre-built
executables. If you'd like to build in a different container, just switch the
image name in the json file and reopen in the new container.
executables. If you'd like to build in a different container, type in the
command palette `Dev Containers: Switch Containers` or
`Dev Containers: Reopen in Container` (depending on if you are in or out of a
container, respectively) and select the one you want.

## Configure, compile and run SpECTRE

Expand Down
5 changes: 2 additions & 3 deletions docs/Tutorials/BeginnersTutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,11 @@ and now you're in the container!

### With VSCode

If you're using VSCode, you'll need the `Remote-Containers` extension to be
able to access the container. Once you have it, open the
Open the
[command palette](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette)
and run the following commands.

1. `Remote-Containers: Attach to Running Container` - you should see the
1. `Dev Containers: Attach to Running Container` - you should see the
container `spectre_demo` that's currently running. Select that.
2. `File: Open Folder` - select `/work/spectre` which is where the repo is.

Expand Down

0 comments on commit 2a72e96

Please sign in to comment.