mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2025-12-27 09:23:52 -05:00
feat(devcontainers): add the ability to use GitHub Codespaces and VS Code remote containers (#5631)
This commit is contained in:
11
.devcontainer/Dockerfile
Normal file
11
.devcontainer/Dockerfile
Normal file
@@ -0,0 +1,11 @@
|
||||
ARG NODE_MAJOR_VERSION
|
||||
|
||||
FROM mcr.microsoft.com/devcontainers/javascript-node:${NODE_MAJOR_VERSION}
|
||||
|
||||
ENV EDITOR="code -w" VISUAL="code -w"
|
||||
|
||||
# install system dependencies for cypress (https://docs.cypress.io/guides/continuous-integration/introduction)
|
||||
RUN apt update && apt install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libnss3 libxss1 libasound2 libxtst6 xauth xvfb
|
||||
|
||||
# uncomment to install additional npm packages
|
||||
# RUN su node -c 'npm i -g cowsay@1.5.0'
|
||||
16
.devcontainer/devcontainer.json
Normal file
16
.devcontainer/devcontainer.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "compiler-explorer",
|
||||
"dockerFile": "Dockerfile",
|
||||
"build": {
|
||||
"args": {"NODE_MAJOR_VERSION": "20"}
|
||||
},
|
||||
"postCreateCommand": [".devcontainer/post-create.sh"],
|
||||
"portsAttributes": {
|
||||
"10240": {"label": "Compiler Explorer"}
|
||||
},
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"extensions": ["dbaeumer.vscode-eslint", "EditorConfig.EditorConfig", "esbenp.prettier-vscode"]
|
||||
}
|
||||
}
|
||||
}
|
||||
14
.devcontainer/post-create.sh
Executable file
14
.devcontainer/post-create.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
# when in a VS Code or GitHub Codespaces devcontainer
|
||||
if [ -n "${REMOTE_CONTAINERS}" ]; then
|
||||
this_dir=$(cd -P -- "$(dirname -- "$(command -v -- "$0")")" && pwd -P)
|
||||
workspace_root=$(realpath ${this_dir}/..)
|
||||
|
||||
# perform additional one-time setup just after
|
||||
# the devcontainer is created
|
||||
npm install --prefix "${workspace_root}" # install node dependencies
|
||||
|
||||
fi
|
||||
@@ -23,6 +23,10 @@ in the right direction.
|
||||
**Compiler Explorer** currently targets [Node.js](https://nodejs.org/) version 20, so it's better if you do so as well
|
||||
when testing your changes locally.
|
||||
|
||||
> Note that this repository is compatible with `GitHub Codespaces` as well as `VS Code Dev Containers`. Opening your
|
||||
> cloned project with either of these options will ensure that your development environment is already set up and
|
||||
> configured correctly!
|
||||
|
||||
## In brief
|
||||
|
||||
- Make your changes, trying to stick to the style and format where possible.
|
||||
|
||||
@@ -139,3 +139,4 @@ From oldest to newest contributor, we would like to thank:
|
||||
- [Seyed Ali Ghasemi](https://github.com/gha3mi)
|
||||
- [Guo Ci](https://github.com/guoci)
|
||||
- [Rupert Tombs](https://github.com/Rupt)
|
||||
- [Andrew Brey](https://github.com/andrewbrey)
|
||||
|
||||
Reference in New Issue
Block a user