diff --git a/.devcontainer.json b/.devcontainer.json new file mode 100644 index 0000000..8944eb2 --- /dev/null +++ b/.devcontainer.json @@ -0,0 +1,26 @@ +{ + "name": "Selenium Tests", + "dockerComposeFile": ["local.yml", "docker-compose.extend.yml"], + "service": "workspace", + "shutdownAction": "stopCompose", + "workspaceFolder": "/workspace/", + "forwardPorts": [8000], + "onCreateCommand": "pip install -r requirements/local.txt && pre-commit install", + "postAttachCommand": "python -m pytest", + "remoteEnv": { + "DATABASE_URL": "postgres://${containerEnv:POSTGRES_USER}:${containerEnv:POSTGRES_PASSWORD}@${containerEnv:POSTGRES_HOST}:${containerEnv:POSTGRES_PORT}/${containerEnv:POSTGRES_DB}" + }, + "customizations": { + "codespaces": { + "openFiles": [] + }, + "vscode": { + "settings": { + "python.testing.pytestArgs": ["tests"], + "python.testing.unittestEnabled": false, + "python.testing.pytestEnabled": true + }, + "extensions": ["ms-python.python"] + } + } +} diff --git a/docker-compose.extend.yml b/docker-compose.extend.yml new file mode 100644 index 0000000..ee5d349 --- /dev/null +++ b/docker-compose.extend.yml @@ -0,0 +1,12 @@ +version: '3' +services: + workspace: + image: mcr.microsoft.com/vscode/devcontainers/python:3.11 + volumes: + # Mounts the project folder to '/workspace'. While this file is in .devcontainer, + # mounts are relative to the first file in the list, which is a level up. + - .:/workspace:cached + command: /bin/sh -c "while sleep 1000; do :; done" + env_file: + - ./.envs/.local/.django + - ./.envs/.local/.postgres