From cd7ea8ab92c502e36340a214b67eb972ea57e096 Mon Sep 17 00:00:00 2001 From: rodrigo Date: Fri, 21 Jun 2024 00:32:09 +0000 Subject: [PATCH 1/3] chore: setup node --- .devcontainer/devcontainer.json | 22 +++++++++------------- .devcontainer/docker-compose.yml | 15 ++++++++++++--- .vscode/settings.json | 11 ++++++++++- 3 files changed, 31 insertions(+), 17 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index e7978a8..15faabf 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,21 +1,17 @@ { - "name": "retro_olympics_webapp", + "name": "retro_olympics", "dockerComposeFile": "docker-compose.yml", - "workspaceFolder": "/workspace", "service": "webapp", + "workspaceFolder": "/workspace", + "features": { + "ghcr.io/devcontainers/features/node:1": { + "nodeGypDependencies": true, + "version": "20.15.0", + "nvmVersion": "latest" + } + }, "customizations": { "vscode": { - "settings": { - "[python]": { - "editor.defaultFormatter": "ms-python.black-formatter", - "editor.formatOnSave": true, - "editor.codeActionsOnSave": { - "source.organizeImports": "always" - } - }, - "isort.args": ["--profile", "black"], - "ruff.nativeServer": true - }, "extensions": [ "ms-python.python", "ms-python.vscode-pylance", diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index c4e1ce5..1f060a8 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -1,4 +1,5 @@ version: "3.8" + services: webapp: build: @@ -7,7 +8,15 @@ services: entrypoint: ["tail", "-f", "/dev/null"] volumes: - ..:/workspace - postgres: - image: "postgres:16" + command: sleep infinity + network_mode: service:db + db: + image: postgres:16-alpine + restart: unless-stopped + volumes: + - postgres-data:/var/lib/postgresql/data environment: - POSTGRES_HOST_AUTH_METHOD: trust \ No newline at end of file + POSTGRES_HOST_AUTH_METHOD: trust + +volumes: + postgres-data: \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index ef4007b..d88b552 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -8,5 +8,14 @@ "eslint.workingDirectories": ["frontend"], "eslint.validate": ["typescript", "typescriptreact"], "typescript.tsdk": "./frontend/node_modules/typescript/lib", - "typescript.enablePromptUseWorkspaceTsdk": true + "typescript.enablePromptUseWorkspaceTsdk": true, + "[python]": { + "editor.defaultFormatter": "ms-python.black-formatter", + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.organizeImports": "always" + } + }, + "isort.args": ["--profile", "black"], + "ruff.nativeServer": true } \ No newline at end of file From fce4f8d0193a030b086e03b35c3beffbbdeb454f Mon Sep 17 00:00:00 2001 From: rodrigo Date: Fri, 21 Jun 2024 00:32:22 +0000 Subject: [PATCH 2/3] chore: update nodejs --- frontend/.nvmrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/.nvmrc b/frontend/.nvmrc index 93a75dd..4746584 100644 --- a/frontend/.nvmrc +++ b/frontend/.nvmrc @@ -1 +1 @@ -v20.14.0 \ No newline at end of file +v20.15.0 \ No newline at end of file From d2cda9c6b09f7623174c3ff05f838cbd4481e637 Mon Sep 17 00:00:00 2001 From: rodrigo Date: Fri, 21 Jun 2024 01:00:31 +0000 Subject: [PATCH 3/3] fix: reduce size of container --- .devcontainer/Dockerfile | 4 ---- .devcontainer/devcontainer.json | 7 ++++--- .devcontainer/docker-compose.yml | 6 +++--- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 2c5e820..0a93e44 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,5 +1 @@ FROM python:3.12 - -# Install python requirements -COPY backend/requirements-combined.txt requirements-combined.txt -RUN pip install -r requirements-combined.txt \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 15faabf..4dc5636 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -2,7 +2,7 @@ "name": "retro_olympics", "dockerComposeFile": "docker-compose.yml", "service": "webapp", - "workspaceFolder": "/workspace", + "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", "features": { "ghcr.io/devcontainers/features/node:1": { "nodeGypDependencies": true, @@ -23,6 +23,7 @@ }, "remoteUser": "root", "remoteEnv": { - "PYTHONPATH": "/workspace/backend/src" - } + "PYTHONPATH": "/workspaces/${localWorkspaceFolderBasename}/backend/src" + }, + "postCreateCommand": "cd backend/ && pip install -r requirements-combined.txt" } diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index 1f060a8..3e6c7ae 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -3,11 +3,11 @@ version: "3.8" services: webapp: build: - context: .. - dockerfile: .devcontainer/Dockerfile + context: . + dockerfile: Dockerfile entrypoint: ["tail", "-f", "/dev/null"] volumes: - - ..:/workspace + - ../..:/workspaces:cached command: sleep infinity network_mode: service:db db: