From 4fd528789d83f85293a7ef4c277f2589ec5d9d22 Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 17 Oct 2026 21:33:08 +0200 Subject: [PATCH] Add devcontainer env --- .devcontainer/devcontainer.json | 56 +++++++++++++++++++ .devcontainer/docker-compose.devcontainer.yml | 8 +++ README.md | 6 +- config.yaml | 2 +- 4 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 .devcontainer/devcontainer.json create mode 100644 .devcontainer/docker-compose.devcontainer.yml diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..f14c6aa --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,56 @@ +{ + "name": "Lunchtime Web", + "dockerComposeFile": [ + "../src/compose.yml", + "docker-compose.devcontainer.yml" + ], + "service": "devcontainer", + "workspaceFolder": "/workspaces/lunchtime-web", + "runServices": [ + "backend", + "frontend", + "mailpit", + "nginx" + ], + "shutdownAction": "stopCompose", + "overrideCommand": false, + "forwardPorts": [ + 8020, + 8025 + ], + "portsAttributes": { + "8020": { + "label": "Lunchtime", + "onAutoForward": "openBrowser" + }, + "8025": { + "label": "Mailpit", + "onAutoForward": "notify" + } + }, + "features": { + "ghcr.io/devcontainers/features/python:1": { + "version": "3.12" + }, + "ghcr.io/devcontainers/features/node:1": { + "version": "20" + } + }, + "customizations": { + "vscode": { + "extensions": [ + "ms-python.python", + "ms-python.vscode-pylance", + "dbaeumer.vscode-eslint" + ], + "settings": { + "python.analysis.extraPaths": [ + "${workspaceFolder}/src/backend" + ], + "python.testing.pytestEnabled": false, + "typescript.tsdk": "${workspaceFolder}/src/frontend/node_modules/typescript/lib" + } + } + }, + "postCreateCommand": "python -m pip install --user -r src/backend/requirements.txt && npm --prefix src/frontend ci" +} diff --git a/.devcontainer/docker-compose.devcontainer.yml b/.devcontainer/docker-compose.devcontainer.yml new file mode 100644 index 0000000..5db9ec2 --- /dev/null +++ b/.devcontainer/docker-compose.devcontainer.yml @@ -0,0 +1,8 @@ +services: + devcontainer: + image: mcr.microsoft.com/devcontainers/base:ubuntu + command: sleep infinity + volumes: + - ..:/workspaces/lunchtime-web:cached + working_dir: /workspaces/lunchtime-web + init: true diff --git a/README.md b/README.md index 7949bf0..a1c599e 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ Then run: docker compose up -d ``` -Open `http://localhost:8080`. +Open `http://localhost:8020`. ## Development @@ -58,7 +58,9 @@ cd src docker compose up -d ``` -This will start the backend and frontend, proxied through Nginx at `http://localhost:8080`. Also, a Mailpit instance at `http://localhost:8025` can be used for monitoring outgoing mail. +This will start the backend and frontend, proxied through Nginx at `http://localhost:8020`. Also, a Mailpit instance at `http://localhost:8025` can be used for monitoring outgoing mail. + +To use the same setup from VS Code, run `Dev Containers: Reopen in Container`. The devcontainer starts the full Compose stack, including Mailpit. Backend changes reload through Uvicorn and frontend changes are served through Vite HMR. ### Backend Development diff --git a/config.yaml b/config.yaml index 88b1310..93442e3 100644 --- a/config.yaml +++ b/config.yaml @@ -1,5 +1,5 @@ app: - public_base_url: "http://localhost:8080/" + public_base_url: "http://localhost:8020/" email: enabled: true