Skip to content
Open
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
28 changes: 12 additions & 16 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
FROM mcr.microsoft.com/vscode/devcontainers/universal:latest
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is specifying the specific python image a python specific thing? For non-Python languages, can we still use .../universal:latest?

FROM mcr.microsoft.com/vscode/devcontainers/python:dev-3.12-bookworm

# Copy custom first notice message.
COPY first-run-notice.txt /tmp/staging/
RUN sudo mv -f /tmp/staging/first-run-notice.txt /usr/local/etc/vscode-dev-containers/ \
&& sudo rm -rf /tmp/staging

# Install PowerShell 7.x
RUN sudo apt-get update \
&& sudo apt-get install -y wget apt-transport-https software-properties-common \
&& wget -q https://packages.microsoft.com/config/ubuntu/$(. /etc/os-release && echo $VERSION_ID)/packages-microsoft-prod.deb \
&& sudo dpkg -i packages-microsoft-prod.deb \
&& sudo apt-get update \
&& sudo apt-get install -y powershell
# Install Node.js and npm
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - \
&& sudo apt-get install -y nodejs

# Install Azure Functions Core Tools
RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg \
&& sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg \
&& sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-$(lsb_release -cs)-prod $(lsb_release -cs) main" > /etc/apt/sources.list.d/dotnetdev.list' \
&& sudo apt-get update \
&& sudo apt-get install -y azure-functions-core-tools-4
# Preview with aarch64 support
RUN sudo npm install -g azure-functions-core-tools

# Install MCP Inspector
RUN sudo npm install -g @modelcontextprotocol/inspector

# Install azurite to emulate Azure Storage
RUN sudo npm install -g azurite

# Install Azure Developer CLI
RUN curl -fsSL https://aka.ms/install-azd.sh | bash

# Install mechanical-markdown for quickstart validations
RUN pip install mechanical-markdown
71 changes: 36 additions & 35 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,37 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/python
{
"name": "Functions Quickstarts Codespace",
"dockerFile": "Dockerfile",
"features": {
"azure-cli": "latest"
},
"customizations": {
"vscode": {
"extensions": [
"ms-azuretools.vscode-bicep",
"ms-azuretools.vscode-docker",
"ms-azuretools.vscode-azurefunctions",
"GitHub.copilot",
"humao.rest-client"
]
}
},
"mounts": [
// Mount docker-in-docker library volume
"source=codespaces-linux-var-lib-docker,target=/var/lib/docker,type=volume"
],
// Always run image-defined docker-init.sh to enable docker-in-docker
"overrideCommand": false,
"remoteUser": "codespace",
"runArgs": [
// Enable ptrace-based debugging for Go in container
"--cap-add=SYS_PTRACE",
"--security-opt",
"seccomp=unconfined",

// Enable docker-in-docker configuration
"--init",
"--privileged"
]
}

"name": "Functions Quickstarts Codespace - Python, aarch64 ready",
"dockerFile": "Dockerfile",
"features": {
"azure-cli": "latest"
},
"forwardPorts": [7071],
"portsAttributes": {
"7071": {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optional: should we mention why this port is being used in the first-run-notice.txt section?

"label": "Azure Functions",
"onAutoForward": "notify"
}
},
"postCreateCommand": "bash -c 'echo \"export PROMPT_DIRTRIM=1\" >> ~/.bashrc || true; mkdir -p ~/.azurite || true; cat .devcontainer/first-run-notice.txt || echo \"Setup completed\"'; npx azurite --location ~/.azurite --silent || true",
"customizations": {
"vscode": {
"extensions": [
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that this is a Python project, are we still intending to install .NET extensions? In other words, should "extensions": [] be runtime specific or something common for all dev container configurations?

"ms-dotnettools.csdevkit",
"ms-dotnettools.dotnet-interactive-vscode",
"ms-azuretools.vscode-bicep",
"ms-azuretools.vscode-docker",
"ms-azuretools.vscode-azurefunctions",
"GitHub.copilot",
"humao.rest-client"
],
"settings": {
"dotnet.completion.showCompletionItemsFromUnimportedNamespaces": true,
"dotnet.symbolSearch.searchReferenceAssemblies": true,
"azureFunctions.showProjectWarning": false
}
}
},
"remoteUser": "vscode",
"shutdownAction": "stopContainer"
}
13 changes: 12 additions & 1 deletion .devcontainer/first-run-notice.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
👋 Welcome to the Functions Codespace! You are on the Functions Quickstarts image.
It includes everything needed to run through our tutorials and quickstart applications.

📚 Functions docs can be found at: https://learn.microsoft.com/en-us/azure/azure-functions/
To run a function enter folder with host.json and run:
```
cd src
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if customers are already in the folder with host.json, then they just need to run func start.

cd src is needed to get into the folder with host.json (if coming from the root).

func start
```

📚 Setup complete. Functions docs can be found at: https://learn.microsoft.com/en-us/azure/azure-functions/
>**Note** it is a best practice to create Virtual Environments before doing the `pip install` to avoid dependency issues/collisions, or if you are running in CodeSpaces. See [Python Environments in VS Code](https://code.visualstudio.com/docs/python/environments#_creating-environments) for more information.


Automatically started Azurite in a new terminal window first via:
```
npx azurite --location ~/.azurite
```