funkčný template
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
PYTHON_BASE=3.13
|
PYTHON_BASE=3.13
|
||||||
|
DEVCONTAINER_IMAGE_REV=0.1
|
||||||
DEVCONTAINER_IMAGE_PULL_REPO=docker.masara.eu/python
|
DEVCONTAINER_IMAGE_PULL_REPO=docker.masara.eu/python
|
||||||
DEVCONTAINER_IMAGE_PUSH_REPO=repo.masara.eu/python
|
DEVCONTAINER_IMAGE_PUSH_REPO=repo.masara.eu/python
|
||||||
DEVCONTAINER_IMAGE_REV=0.1
|
|
||||||
|
|||||||
@@ -1,49 +1,53 @@
|
|||||||
{
|
{
|
||||||
"name": "Python Dev",
|
"name": "Python Dev",
|
||||||
"dockerComposeFile": "docker-compose.yml",
|
"containerEnv": {
|
||||||
"service": "dev",
|
"PIP_INDEX_URL": "https://dv.masara.eu/repository/pypi-group/simple",
|
||||||
"containerEnv": {
|
"PIP_ROOT_USER_ACTION": "ignore"
|
||||||
"PIP_INDEX_URL": "https://dv.masara.eu/repository/pypi-group/simple",
|
},
|
||||||
"PIP_ROOT_USER_ACTION": "ignore"
|
"remoteEnv": {
|
||||||
},
|
"DOCKER_BUILDKIT": "1",
|
||||||
"remoteEnv": {
|
"VIRTUAL_ENV": "/workspace/.venv",
|
||||||
"DOCKER_BUILDKIT": "1"
|
"PATH": "/workspace/.venv/bin:${containerEnv:PATH}"
|
||||||
},
|
},
|
||||||
"workspaceFolder": "/workspace",
|
"workspaceFolder": "/workspace",
|
||||||
"remoteUser": "root",
|
"remoteUser": "root",
|
||||||
"customizations": {
|
"overrideCommand": true,
|
||||||
"vscode": {
|
"customizations": {
|
||||||
"extensions": [
|
"vscode": {
|
||||||
"ms-python.python",
|
"extensions": [
|
||||||
"ms-python.vscode-pylance",
|
"ms-python.python",
|
||||||
"ms-toolsai.jupyter",
|
"ms-python.vscode-pylance",
|
||||||
"ms-python.black-formatter",
|
"ms-toolsai.jupyter",
|
||||||
"ms-python.isort",
|
"ms-python.black-formatter",
|
||||||
"ms-azuretools.vscode-docker"
|
"ms-python.isort",
|
||||||
],
|
"ms-azuretools.vscode-docker",
|
||||||
"settings": {
|
"openai.chatgpt"
|
||||||
"python.formatting.provider": "black",
|
],
|
||||||
"python.analysis.extraPaths": [
|
"settings": {
|
||||||
"${workspaceFolder}/app"
|
"python.formatting.provider": "black",
|
||||||
],
|
"python.analysis.extraPaths": [
|
||||||
"editor.formatOnSave": true,
|
"${workspaceFolder}/app"
|
||||||
"python.terminal.activateEnvironment": true,
|
],
|
||||||
"python.defaultInterpreterPath": ".venv/bin/python",
|
"editor.formatOnSave": true,
|
||||||
"remote.restoreForwardedPorts": false,
|
"python.terminal.activateEnvironment": true,
|
||||||
"remote.autoForwardPortsSource": "output",
|
"python.defaultInterpreterPath": ".venv/bin/python",
|
||||||
"debug.javascript.autoAttachFilter": "disabled"
|
"remote.restoreForwardedPorts": false,
|
||||||
}
|
"remote.autoForwardPortsSource": "output",
|
||||||
}
|
"debug.javascript.autoAttachFilter": "disabled"
|
||||||
},
|
}
|
||||||
"mounts": [
|
}
|
||||||
"type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock"
|
},
|
||||||
],
|
"mounts": [
|
||||||
"postCreateCommand": "bash .devcontainer/post_create.sh",
|
"type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock",
|
||||||
"forwardPorts": [
|
"type=bind,source=${localEnv:USERPROFILE}/.codex,target=/root/.codex"
|
||||||
],
|
],
|
||||||
"portsAttributes": {
|
"postCreateCommand": "bash .devcontainer/post_create.sh",
|
||||||
"*": {
|
"forwardPorts": [],
|
||||||
"onAutoForward": "ignore"
|
"portsAttributes": {
|
||||||
}
|
"*": {
|
||||||
}
|
"onAutoForward": "ignore"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"image": "docker.masara.eu/python:3.13-0.1-devcontainer",
|
||||||
|
"workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
services:
|
services:
|
||||||
dev:
|
dev:
|
||||||
image: ${DEVCONTAINER_IMAGE_PULL_REPO}:${PYTHON_BASE}-${DEVCONTAINER_IMAGE_REV}-devcontainer
|
image: ${DEVCONTAINER_IMAGE_PULL_REPO}:${PYTHON_BASE}-${DEVCONTAINER_IMAGE_REV}-devcontainer
|
||||||
pull_policy: always
|
pull_policy: always
|
||||||
init: true
|
init: true
|
||||||
|
command: sleep infinity
|
||||||
|
tty: true
|
||||||
volumes:
|
volumes:
|
||||||
- ..:/workspace:cached
|
- ..:/workspace:cached
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
@@ -7,24 +7,29 @@ VENV_PATH="/workspace/.venv"
|
|||||||
if [ ! -d "$VENV_PATH" ]; then
|
if [ ! -d "$VENV_PATH" ]; then
|
||||||
echo "Virtuálne prostredie neexistuje – vytváram..."
|
echo "Virtuálne prostredie neexistuje – vytváram..."
|
||||||
python -m venv "$VENV_PATH"
|
python -m venv "$VENV_PATH"
|
||||||
|
|
||||||
echo "Aktivujem virtuálne prostredie..."
|
|
||||||
# shellcheck disable=SC1090
|
|
||||||
source "$VENV_PATH/bin/activate"
|
|
||||||
|
|
||||||
echo "Aktualizujem pip a základné nástroje..."
|
|
||||||
pip install --upgrade pip setuptools wheel
|
|
||||||
else
|
else
|
||||||
echo "Používam existujúce virtuálne prostredie..."
|
echo "Používam existujúce virtuálne prostredie..."
|
||||||
# shellcheck disable=SC1090
|
|
||||||
# source "$VENV_PATH/bin/activate"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Aktivujem virtuálne prostredie..."
|
||||||
|
# shellcheck disable=SC1090
|
||||||
|
source "$VENV_PATH/bin/activate"
|
||||||
|
|
||||||
|
echo "Aktualizujem pip a základné nástroje..."
|
||||||
|
python -m pip install --upgrade pip setuptools wheel
|
||||||
|
|
||||||
# Inštalácia závislostí, ak existuje requirements.txt
|
# Inštalácia závislostí, ak existuje requirements.txt
|
||||||
if [ -f "/workspace/requirements.txt" ]; then
|
if [ -f "/workspace/requirements.txt" ]; then
|
||||||
echo "Inštalujem závislosti z requirements.txt..."
|
echo "Inštalujem závislosti z requirements.txt..."
|
||||||
pip install -r /workspace/requirements.txt
|
python -m pip install -r /workspace/requirements.txt
|
||||||
else
|
else
|
||||||
echo "requirements.txt nenájdený – preskakujem inštaláciu závislostí."
|
echo "requirements.txt nenájdený – preskakujem inštaláciu závislostí."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Ak sa terminál otvorí skôr, než Python extension stihne auto-aktiváciu,
|
||||||
|
# zabezpečíme aktiváciu aj cez shell init.
|
||||||
|
BASHRC="/root/.bashrc"
|
||||||
|
ACTIVATE_LINE='[ -f /workspace/.venv/bin/activate ] && source /workspace/.venv/bin/activate'
|
||||||
|
if ! grep -Fq "$ACTIVATE_LINE" "$BASHRC"; then
|
||||||
|
echo "$ACTIVATE_LINE" >> "$BASHRC"
|
||||||
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user