Skip to content

Commit

Permalink
Simplify devcontainer setup, update README
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikhorluck committed May 5, 2024
1 parent 8ba2ad2 commit 6b0153c
Show file tree
Hide file tree
Showing 13 changed files with 98 additions and 413 deletions.
30 changes: 0 additions & 30 deletions .devcontainer/Dockerfile

This file was deleted.

8 changes: 7 additions & 1 deletion .devcontainer/devcontainer.env
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
# Modify this file if you want to change default environment variables in the dev-environment
# Use postgresql, currently makes the tests fail
# DATABASE_URL=postgres://postgres:postgres@db:5432/onlineweb4
DATABASE_URL=postgres://postgres:postgres@db:5432/onlineweb4
DJANGO_SETTINGS_MODULE=onlineweb4.settings
LOG_LEVEL=INFO

# contact dotkom for these
AUTH0_CLIENT_ID=
AUTH0_CLIENT_SECRET=
AUTH0_ISSUER=https://auth.dev.online.ntnu.no
AUTH0_MGMT_TENANT=https://onlineweb.eu.auth0.com/api/v2/

# make `npm run build && py.test` work
OW4_WEBPACK_LOADER_STATS_FILE = webpack-stats.json

Expand Down
62 changes: 31 additions & 31 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,42 @@
// Note that this file cannot have trailing commas, since it is modified as part of CI with jq
{
"name": "OnlineWeb4",
"dockerComposeFile": [
"docker-compose.yml"
],
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/workspace",
"workspaceFolder": "/workspace/${localWorkspaceFolderBasename}",
// Set *default* container specific settings.json values on container create.
"settings": {
"python.defaultInterpreterPath": "${containerEnv:POETRY_ENV_PATH}/bin/python",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.testing.cwd": "/workspace",
"python.formatting.autopep8Path": "${containerEnv:POETRY_ENV_PATH}/bin/autopep8",
"python.formatting.blackPath": "${containerEnv:POETRY_ENV_PATH}/bin/black",
"python.formatting.yapfPath": "${containerEnv:POETRY_ENV_PATH}/bin/yapf",
"python.linting.banditPath": "${containerEnv:POETRY_ENV_PATH}/bin/bandit",
"python.linting.flake8Path": "${containerEnv:POETRY_ENV_PATH}/bin/flake8",
"python.linting.mypyPath": "${containerEnv:POETRY_ENV_PATH}/bin/mypy",
"python.linting.pycodestylePath": "${containerEnv:POETRY_ENV_PATH}/bin/pycodestyle",
"python.linting.pydocstylePath": "${containerEnv:POETRY_ENV_PATH}/bin/pydocstyle",
"python.linting.pylintPath": "${containerEnv:POETRY_ENV_PATH}/bin/pylint",
"python.testing.pytestPath": "${containerEnv:POETRY_ENV_PATH}/bin/pytest"
"customizations": {
"vscode": {
"settings": {
"python.defaultInterpreterPath": "${containerEnv:POETRY_ENV_PATH}/bin/python",
"python.testing.cwd": "/workspace",
"python.testing.pytestPath": "${containerEnv:POETRY_ENV_PATH}/bin/pytest",
"dev.containers.copyGitConfig": true
},
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance",
"charliermarsh.ruff",
"tamasfe.even-better-toml",
"eamodio.gitlens"
]
}
},
"features": {
"ghcr.io/devcontainers/features/node:1": {
"version": "18"
},
"ghcr.io/devcontainers-contrib/features/poetry:2": {
"version": "1.8.2"
}
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance",
"bungcip.better-toml"
],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// This can be used to network with other containers or the host.
"forwardPorts": [
8000, // Django
3000 // webpack-dev-server
],
8000 // Django
]
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "poetry install && export POETRY_ENV_PATH=$(poetry env info --path) && poetry run pre-commit install --install-hooks",
// "postCreateCommand": "poetry install && export POETRY_ENV_PATH=$(poetry env info --path) && poetry run pre-commit install --install-hooks",
// avoids notification about no python-interpreter selected
"waitFor": "postCreateCommand"
}
// "waitFor": "postCreateCommand"
}
14 changes: 0 additions & 14 deletions .devcontainer/docker-compose.build.yml

This file was deleted.

16 changes: 0 additions & 16 deletions .devcontainer/docker-compose.no-deps-build.yml

This file was deleted.

5 changes: 0 additions & 5 deletions .devcontainer/docker-compose.no-deps.yml

This file was deleted.

8 changes: 4 additions & 4 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
version: '3.8'
name: onlineweb4

services:
app:
# we do not include the build-definition here, since that prevents us from using the pre-built image.
image: ghcr.io/dotkom/onlineweb4-devcontainer:latest-full
image: mcr.microsoft.com/devcontainers/python:3.11-bullseye
volumes:
- ..:/workspace:cached
- ../..:/workspace:cached
# Overrides default command so things don't shut down after the process ends.
command: sleep infinity
# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
Expand All @@ -20,7 +20,7 @@ services:
# (Adding the "ports" property to this file will not forward from a Codespace.)

db:
image: postgres:latest
image: postgres:16
restart: unless-stopped
volumes:
- postgres-data:/var/lib/postgresql/data
Expand Down
45 changes: 0 additions & 45 deletions .github/workflows/build-devcontainer.yml

This file was deleted.

22 changes: 0 additions & 22 deletions .github/workflows/devcontainer-no-deps.yml

This file was deleted.

26 changes: 0 additions & 26 deletions .github/workflows/devcontainer-with-deps.yml

This file was deleted.

12 changes: 0 additions & 12 deletions .gitpod.Dockerfile

This file was deleted.

24 changes: 0 additions & 24 deletions .gitpod.yml

This file was deleted.

Loading

0 comments on commit 6b0153c

Please sign in to comment.