|
| 1 | +{ |
| 2 | + "$schema": "https://raw.githubusercontent.com/devcontainers/spec/main/schemas/devContainer.schema.json", |
| 3 | + "name": "APIM Samples", |
| 4 | + "build": { |
| 5 | + "dockerfile": "Dockerfile", |
| 6 | + "context": ".." |
| 7 | + }, |
| 8 | + "features": { |
| 9 | + "ghcr.io/devcontainers/features/azure-cli:1": { |
| 10 | + "version": "2.72.0" |
| 11 | + }, |
| 12 | + "ghcr.io/devcontainers/features/common-utils:2": { |
| 13 | + "installZsh": true, |
| 14 | + "configureZshAsDefaultShell": true, |
| 15 | + "installOhMyZsh": true, |
| 16 | + "upgradePackages": true, |
| 17 | + "username": "vscode", |
| 18 | + "uid": "1000", |
| 19 | + "gid": "1000" |
| 20 | + }, |
| 21 | + "ghcr.io/devcontainers/features/git:1": { |
| 22 | + "version": "latest", |
| 23 | + "ppa": true |
| 24 | + }, |
| 25 | + "ghcr.io/devcontainers/features/docker-in-docker:2": { |
| 26 | + "version": "latest", |
| 27 | + "enableNonRootDocker": "true" |
| 28 | + } |
| 29 | + }, |
| 30 | + "customizations": { |
| 31 | + "vscode": { |
| 32 | + "extensions": [ |
| 33 | + "ms-python.python", |
| 34 | + "ms-python.debugpy", |
| 35 | + "ms-toolsai.jupyter", |
| 36 | + "ms-toolsai.jupyter-keymap", |
| 37 | + "ms-toolsai.jupyter-renderers", |
| 38 | + "ms-toolsai.vscode-jupyter-cell-tags", |
| 39 | + "ms-toolsai.vscode-jupyter-slideshow", |
| 40 | + "ms-azuretools.vscode-bicep", |
| 41 | + "ms-vscode.azurecli", |
| 42 | + "ms-azure-devops.azure-pipelines", |
| 43 | + "GitHub.copilot", |
| 44 | + "GitHub.copilot-chat", |
| 45 | + "redhat.vscode-yaml", |
| 46 | + "ms-vscode.vscode-json", |
| 47 | + "donjayamanne.vscode-default-python-kernel" |
| 48 | + ], |
| 49 | + "settings": { |
| 50 | + "python.defaultInterpreterPath": "/workspaces/Apim-Samples/.venv/bin/python", |
| 51 | + "python.pythonPath": "/workspaces/Apim-Samples/.venv/bin/python", |
| 52 | + "python.terminal.activateEnvironment": true, |
| 53 | + "python.terminal.activateEnvInCurrentTerminal": true, |
| 54 | + "python.envFile": "${workspaceFolder}/.env", |
| 55 | + "python.linting.enabled": true, |
| 56 | + "python.linting.pylintEnabled": true, |
| 57 | + "python.formatting.autopep8Path": "/workspaces/Apim-Samples/.venv/bin/autopep8", |
| 58 | + "python.formatting.blackPath": "/workspaces/Apim-Samples/.venv/bin/black", |
| 59 | + "python.formatting.yapfPath": "/workspaces/Apim-Samples/.venv/bin/yapf", |
| 60 | + "python.linting.banditPath": "/workspaces/Apim-Samples/.venv/bin/bandit", |
| 61 | + "python.linting.flake8Path": "/workspaces/Apim-Samples/.venv/bin/flake8", |
| 62 | + "python.linting.mypyPath": "/workspaces/Apim-Samples/.venv/bin/mypy", |
| 63 | + "python.linting.pycodestylePath": "/workspaces/Apim-Samples/.venv/bin/pycodestyle", |
| 64 | + "python.linting.pydocstylePath": "/workspaces/Apim-Samples/.venv/bin/pydocestyle", |
| 65 | + "python.linting.pylintPath": "/workspaces/Apim-Samples/.venv/bin/pylint", |
| 66 | + "python.testing.pytestPath": "/workspaces/Apim-Samples/.venv/bin/pytest", |
| 67 | + "jupyter.askForKernelRestart": false, |
| 68 | + "jupyter.interactiveWindow.textEditor.executeSelection": true, |
| 69 | + "jupyter.notebookFileRoot": "${workspaceFolder}", |
| 70 | + "jupyter.kernels.excludePythonEnvironments": [ |
| 71 | + "**/anaconda3/**", |
| 72 | + "**/conda/**", |
| 73 | + "**/miniconda3/**", |
| 74 | + "**/python3.*", |
| 75 | + "*/site-packages/*", |
| 76 | + "/bin/python", |
| 77 | + "/bin/python3", |
| 78 | + "/opt/python/*/bin/python*", |
| 79 | + "/usr/bin/python", |
| 80 | + "/usr/bin/python3", |
| 81 | + "/usr/local/bin/python", |
| 82 | + "/usr/local/bin/python3", |
| 83 | + "python", |
| 84 | + "python3" |
| 85 | + ], |
| 86 | + "jupyter.kernels.trusted": [ |
| 87 | + "/workspaces/Apim-Samples/.venv/bin/python" |
| 88 | + ], |
| 89 | + "files.associations": { |
| 90 | + "*.bicep": "bicep" |
| 91 | + }, |
| 92 | + "terminal.integrated.showExitAlert": false, |
| 93 | + "terminal.integrated.focusAfterRun": "terminal", |
| 94 | + "terminal.integrated.defaultProfile.linux": "bash", |
| 95 | + "terminal.integrated.tabs.enabled": true, |
| 96 | + "workbench.panel.defaultLocation": "bottom", |
| 97 | + "workbench.panel.opensMaximized": "preserve", |
| 98 | + "workbench.startupEditor": "none", |
| 99 | + "workbench.panel.defaultPanelHeight": 400, |
| 100 | + "workbench.view.alwaysShowHeaderActions": true, |
| 101 | + "workbench.action.terminal.focus": true, |
| 102 | + "workbench.action.togglePanel": true, |
| 103 | + "terminal.integrated.defaultLocation": "view", |
| 104 | + "security.workspace.trust.enabled": false, |
| 105 | + "editor.experimental.pasteActions.enabled": true, |
| 106 | + "workbench.editor.enablePreview": false |
| 107 | + } |
| 108 | + }, |
| 109 | + "containerEnv": { |
| 110 | + "PATH": "/workspaces/Apim-Samples/.venv/bin:${PATH}", |
| 111 | + "PYTHONPATH": "/workspaces/Apim-Samples/shared/python:/workspaces/Apim-Samples", |
| 112 | + "VIRTUAL_ENV": "/workspaces/Apim-Samples/.venv" |
| 113 | + } |
| 114 | + }, |
| 115 | + "onCreateCommand": [ |
| 116 | + "bash", |
| 117 | + "-c", |
| 118 | + "echo '🚀 Creating Python virtual environment in workspace...' && /usr/local/bin/python3.12 -m venv /workspaces/Apim-Samples/.venv --copies && source /workspaces/Apim-Samples/.venv/bin/activate && pip install --upgrade pip setuptools wheel ipykernel && echo '✅ Virtual environment created' && echo '🔧 Registering Jupyter kernel during prebuild...' && python -m ipykernel install --user --name=apim-samples --display-name='APIM Samples Python 3.12' && echo '🧹 Removing default python3 kernel...' && rm -rf /workspaces/Apim-Samples/.venv/share/jupyter/kernels/python3 2>/dev/null || true && echo '✅ Jupyter kernel registered in prebuild'" |
| 119 | + ], |
| 120 | + "updateContentCommand": [ |
| 121 | + "bash", |
| 122 | + "-c", |
| 123 | + "echo '📦 Installing/updating Python packages from requirements.txt...' && source /workspaces/Apim-Samples/.venv/bin/activate && pip install -r requirements.txt && pip install pytest pytest-cov coverage && echo '✅ Python packages installed/updated' && python setup/setup_python_path.py --generate-env && echo '✅ Environment configuration updated' && echo '⚙️ Configuring Azure CLI...' && az config set core.login_experience_v2=off 2>/dev/null || true && az extension add --name containerapp --only-show-errors 2>/dev/null || true && az extension add --name front-door --only-show-errors 2>/dev/null || true && echo '✅ Azure CLI configured for Codespaces'" |
| 124 | + ], |
| 125 | + "postStartCommand": [ |
| 126 | + "bash", |
| 127 | + "-c", |
| 128 | + "echo 'APIM Samples Codespace Starting - Keep this terminal open to see progress!' && bash .devcontainer/post-start-setup.sh" |
| 129 | + ], |
| 130 | + "forwardPorts": [ |
| 131 | + 8000, |
| 132 | + 8080, |
| 133 | + 5000, |
| 134 | + 3000 |
| 135 | + ], |
| 136 | + "portsAttributes": { |
| 137 | + "8000": { |
| 138 | + "label": "Python Development Server", |
| 139 | + "onAutoForward": "notify" |
| 140 | + }, |
| 141 | + "8080": { |
| 142 | + "label": "Alternative HTTP Server", |
| 143 | + "onAutoForward": "notify" |
| 144 | + }, |
| 145 | + "5000": { |
| 146 | + "label": "Flask Development Server", |
| 147 | + "onAutoForward": "notify" |
| 148 | + }, |
| 149 | + "3000": { |
| 150 | + "label": "Node.js Development Server", |
| 151 | + "onAutoForward": "notify" |
| 152 | + } |
| 153 | + }, |
| 154 | + "remoteUser": "vscode", |
| 155 | + "workspaceFolder": "/workspaces/Apim-Samples", |
| 156 | + "mounts": [], |
| 157 | + "runArgs": [ |
| 158 | + "--init" |
| 159 | + ] |
| 160 | +} |
0 commit comments