Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Commit

Permalink
feat(devcontainer): create devcontainer definition
Browse files Browse the repository at this point in the history
This sets up a complete development environment for Decide,
which can be used locally with Docker or in the cloud with
GitHub Codespaces

Signed-off-by: GitHub <noreply@github.com>
ferferga committed Dec 13, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 137a9ba commit ec3d6ff
Showing 4 changed files with 50 additions and 2 deletions.
29 changes: 29 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "Decide Codespace",
"image": "python:latest",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"dockerDashComposeVersion": "v2"
},
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/eitsupi/devcontainer-features/jq-likes:2": {},
"ghcr.io/devcontainers/features/node:1": {},
"ghcr.io/devcontainers-contrib/features/apt-packages:1": {
"preserve_apt_list": false,
"packages": ["postgresql", "libpq-dev", "htop"]
}
},
"postCreateCommand": {
"npm": "npm ci --workspaces",
"pip": "pip install -r requirements.txt",
"use-bash": "rm -rf /bin/sh && ln -s /bin/bash /bin/sh",
"git-editor": "git config --global core.editor 'code --wait'",
"git-template": "git config commit.template .gitmessage.txt",
"postunpack": "service postgresql start && .devcontainer/postunpack.sh"
},
"postAttachCommand": {
"extensions": "cat .vscode/extensions.json | jq -r .recommendations[] | xargs -n 1 code --install-extension",
"postgres": "service postgresql start"
},
"hostRequirements": { "cpus": 4, "memory": "8gb" }
}
14 changes: 14 additions & 0 deletions .devcontainer/postunpack.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

## This script finishes the installation of the devcontainer
##
## Currently it just sets up the database user using decide's local_settings.py default values
## If you want to modify those credentials,
## you can alter them at any time manually: https://stackoverflow.com/questions/12720967/how-can-i-change-a-postgresql-user-password

su - postgres <<EOSQL
psql -c "create user decide with password 'decide'"
psql -c "create database decide owner decide"
EOSQL

echo "127.0.0.1 db" >> /etc/hosts
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"ms-python.python"
]
}
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"source.organizeImports": false
"source.fixAll.eslint": "always",
"source.organizeImports": "always"
},
"[javascript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"

0 comments on commit ec3d6ff

Please sign in to comment.