Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Node.js to devcontainer and reduce size #3

Merged
merged 3 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
27 changes: 12 additions & 15 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
{
"name": "retro_olympics_webapp",
"name": "retro_olympics",
"dockerComposeFile": "docker-compose.yml",
"workspaceFolder": "/workspace",
"service": "webapp",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
"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",
Expand All @@ -27,6 +23,7 @@
},
"remoteUser": "root",
"remoteEnv": {
"PYTHONPATH": "/workspace/backend/src"
}
"PYTHONPATH": "/workspaces/${localWorkspaceFolderBasename}/backend/src"
},
"postCreateCommand": "cd backend/ && pip install -r requirements-combined.txt"
}
21 changes: 15 additions & 6 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
version: "3.8"

services:
webapp:
build:
context: ..
dockerfile: .devcontainer/Dockerfile
context: .
dockerfile: Dockerfile
entrypoint: ["tail", "-f", "/dev/null"]
volumes:
- ..:/workspace
postgres:
image: "postgres:16"
- ../..:/workspaces:cached
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
POSTGRES_HOST_AUTH_METHOD: trust

volumes:
postgres-data:
11 changes: 10 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion frontend/.nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v20.14.0
v20.15.0