Skip to content

Commit

Permalink
Add a VSCode .devcontainer setup. (#1583)
Browse files Browse the repository at this point in the history
This adds experimental support for using VSCode's remote container development with this project.
  • Loading branch information
toolness authored Jul 6, 2020
1 parent c158605 commit 9d13026
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM justfixnyc/tenants2_base:0.10

# This is needed to work around the following issue:
# https://github.com/microsoft/vscode-remote-release/issues/935
ENV NODE_ICU_DATA ""
58 changes: 58 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.122.1/containers/docker-existing-dockerfile
{
"name": "JustFix.nyc Tenant Platform VSCode development container",
"context": "../.devcontainer",
"dockerFile": "../.devcontainer/Dockerfile",

// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": null,
// This is where the virtual environment set up by our Docker Compose config is located.
"python.pythonPath": "/venv/bin/python",
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": true,
"python.linting.enabled": true,
"python.linting.mypyEnabled": true,
"eslint.options": {
// VSCode will put our tenants2 repository at /workspaces/tenants2,
// so that's where we need to find our custom ESLint rules.
"rulePaths": ["/workspaces/tenants2/frontend/eslint/rules"]
},
"[typescriptreact]": {
"editor.tabSize": 2,
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.tabSize": 2,
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[python]": {
"editor.detectIndentation": false,
"editor.tabSize": 4
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-python.python",
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint",
],

"mounts": [
// These mounts will ensure that the volumes our Docker Compose setup uses
// (see `docker-services.yml`) will be reused by VSCode. Note that these
// rely on the project to be cloned in a folder called `tenants2`, since
// Docker Compose prefixes the volumes it creates with this directory name.
"source=tenants2_python-venv,target=/venv/,type=volume",
"source=tenants2_unused-node-modules,target=/workspaces/tenants2/node_modules/,type=volume",
"source=tenants2_node-modules,target=/node_modules/,type=volume",
],
}
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ frontend/vendor
.babel-cache.json
schema.json

# This is a weird JSON format, ignore it for now.
# These use a weird JSON format, ignore for now.
tsconfig.json
.devcontainer/devcontainer.json

# Don't go in that black hole!
node_modules
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,9 @@ To push your new version, you will need to:
3. Run `docker push justfixnyc/tenants2_base:0.1` to
push the new image to Docker Hub.

4. In `Dockerfile.web`, `docker-services.yml`, and `.circleci/config.yml`,
edit the references to `justfixnyc/tenants2_base` to point to the new tag.
4. In `Dockerfile.web`, `docker-services.yml`, `.circleci/config.yml`,
and `.devcontainer/Dockerfile`, edit the references to
`justfixnyc/tenants2_base` to point to the new tag.

[CircleCI]: https://circleci.com/
[already taken]: https://hub.docker.com/r/justfixnyc/tenants2_base/tags/
Expand Down

0 comments on commit 9d13026

Please sign in to comment.