venv and pip install in dockerfile

This commit is contained in:
Dobromir Popov
2023-12-19 20:44:51 +00:00
parent 2a947d6c7c
commit b27700ae5c
6 changed files with 103 additions and 22 deletions

18
.vscode/launch.json vendored
View File

@ -12,13 +12,25 @@
"platform": "node"
},
{
"name": "Docker Python Launch",
"name": "Docker Python Launch?",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/agent-py-bot/agent.py",
"console": "integratedTerminal",
"pythonPath": "${command:python.interpreterPath}", // Assumes Python extension is installed
"preLaunchTask": "docker-run: python-debug", // You may need to create this task
// "python": "${command:python.interpreterPath}", // Assumes Python extension is installed
// "preLaunchTask": "docker-run: python-debug", // You may need to create this task
// "env": {
// "PYTHONUNBUFFERED": "1"
// }
},
{
"name": "Docker Python Launch with venv",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/agent-py-bot/agent.py",
"console": "integratedTerminal",
"preLaunchTask": "activate-venv", // Custom task to activate venv and run Docker
"python": "/venv/bin/python", // Path to the Python interpreter in your venv
"env": {
"PYTHONUNBUFFERED": "1"
}

58
.vscode/tasks.json vendored
View File

@ -19,22 +19,22 @@
],
"platform": "node"
},
{
"type": "docker-run",
"label": "docker-run: debug",
"dependsOn": [
"docker-build"
],
"dockerRun": {
"env": {
"DEBUG": "*",
"NODE_ENV": "development"
}
},
"node": {
"enableDebugging": true
}
},
// {
// "type": "docker-run",
// "label": "docker-run: debug2",
// "dependsOn": [
// "docker-build"
// ],
// "dockerRun": {
// "env": {
// "DEBUG": "*",
// "NODE_ENV": "development"
// }
// },
// "node": {
// "enableDebugging": true
// }
// },
{
"type": "npm",
"script": "start",
@ -45,8 +45,30 @@
{
"label": "python-debug",
"type": "shell",
"command": "docker exec -w /workspace -it my-python-container /bin/bash -c 'source activate py && python -m debugpy --listen 0.0.0.0:5678 agent-py-bot/agent.py'",
"command": "python -m debugpy --listen 0.0.0.0:5678 agent-py-bot/agent.py",
// "command": "docker exec -w /workspace -it my-python-container /bin/bash -c 'source activate py && python -m debugpy --listen 0.0.0.0:5678 agent-py-bot/agent.py'",
"problemMatcher": []
}
},
{
"label": "activate-venv-and-run-docker",
"type": "shell",
"command": "source /venv/bin/activate && docker-compose up", // Example command
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
}
// ,{
// "label": "activate-venv",
// "type": "shell",
// "command": "source /venv/bin/activate", // Example command
// "problemMatcher": [],
// "group": {
// "kind": "build",
// "isDefault": true
// }
// }
]
}