Skip to content

Commit ef2b03a

Browse files
committed
Update devcontainer to simplify setup
1 parent 7ed1052 commit ef2b03a

File tree

8 files changed

+132
-64
lines changed

8 files changed

+132
-64
lines changed

.devcontainer/Dockerfile

-20
This file was deleted.

.devcontainer/devcontainer.json

+33-24
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
{
22
"name": "Azure Functions AI Document Pipeline",
3-
"build": {
4-
"dockerfile": "Dockerfile",
5-
"context": ".."
6-
},
3+
"image": "mcr.microsoft.com/devcontainers/base:1-bookworm",
74
"features": {
85
"ghcr.io/devcontainers/features/git:1": {
96
"version": "latest",
@@ -12,24 +9,24 @@
129
"ghcr.io/devcontainers/features/powershell:1": {},
1310
"ghcr.io/devcontainers/features/azure-cli:1": {},
1411
"ghcr.io/azure/azure-dev/azd:0": {},
15-
"ghcr.io/devcontainers/features/git-lfs:1": {
16-
"version": "latest"
17-
},
18-
"ghcr.io/devcontainers/features/github-cli:1": {
19-
"version": "latest"
12+
"ghcr.io/devcontainers/features/python:1": {
13+
"version": "3.12"
2014
},
21-
"ghcr.io/devcontainers/features/docker-in-docker:2": {
22-
"version": "latest"
23-
}
15+
"ghcr.io/devcontainers/features/git-lfs:1": {},
16+
"ghcr.io/devcontainers/features/github-cli:1": {},
17+
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
18+
"./local-features/dev-tools": "latest"
2419
},
2520
"overrideFeatureInstallOrder": [
2621
"ghcr.io/devcontainers/features/git",
2722
"ghcr.io/devcontainers/features/powershell",
2823
"ghcr.io/devcontainers/features/azure-cli",
2924
"ghcr.io/azure/azure-dev/azd",
25+
"ghcr.io/devcontainers/features/python",
3026
"ghcr.io/devcontainers/features/git-lfs",
3127
"ghcr.io/devcontainers/features/github-cli",
32-
"ghcr.io/devcontainers/features/docker-in-docker"
28+
"ghcr.io/devcontainers/features/docker-in-docker",
29+
"./local-features/dev-tools"
3330
],
3431
"remoteUser": "vscode",
3532
"containerUser": "vscode",
@@ -40,22 +37,34 @@
4037
"customizations": {
4138
"vscode": {
4239
"extensions": [
43-
"ms-python.vscode-pylance",
40+
"GitHub.remotehub",
41+
"GitHub.copilot",
42+
"GitHub.copilot-chat",
43+
"github.vscode-pull-request-github",
44+
"GitHub.vscode-github-actions",
45+
"ms-azuretools.azure-dev",
46+
"ms-azuretools.vscode-bicep",
47+
"ms-azuretools.vscode-docker",
48+
"ms-azuretools.vscode-azureresourcegroups",
49+
"ms-azuretools.vscode-azurefunctions",
50+
"ms-azuretools.vscode-azure-github-copilot",
4451
"ms-python.python",
4552
"ms-python.debugpy",
46-
"tomoki1207.pdf",
47-
"ms-azuretools.vscode-bicep",
53+
"ms-python.vscode-pylance",
54+
"ms-python.autopep8",
4855
"ms-vscode.vscode-node-azure-pack",
49-
"ms-vscode.PowerShell",
50-
"GitHub.vscode-pull-request-github",
51-
"ms-azuretools.vscode-azurefunctions",
56+
"ms-vscode.powershell",
57+
"ms-vscode-remote.vscode-remote-extensionpack",
58+
"ms-vscode-remote.remote-containers",
59+
"Azurite.azurite",
5260
"DurableFunctionsMonitor.durablefunctionsmonitor",
53-
"EditorConfig.EditorConfig",
61+
"esbenp.prettier-vscode",
5462
"humao.rest-client",
55-
"ms-azuretools.vscode-docker",
56-
"ms-vscode-remote.remote-containers",
57-
"Azurite.azurite"
63+
"VisualStudioExptTeam.vscodeintellicode",
64+
"eamodio.gitlens",
65+
"EditorConfig.EditorConfig"
5866
]
5967
}
60-
}
68+
},
69+
"postCreateCommand": ".devcontainer/post-create.sh"
6170
}

.devcontainer/install-tools.sh

-12
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"id": "dev-tools",
3+
"version": "0.1.0",
4+
"name": "Dev Tools",
5+
"description": "Required tools for developing and running the project."
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/usr/bin/env bash
2+
3+
USERNAME=${USERNAME:-"vscode"}
4+
5+
set -eux
6+
7+
# Setup STDERR.
8+
err() {
9+
echo "(!) $*" >&2
10+
}
11+
12+
if [ "$(id -u)" -ne 0 ]; then
13+
err 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
14+
exit 1
15+
fi
16+
17+
# Ensure apt is in non-interactive to avoid prompts
18+
export DEBIAN_FRONTEND=noninteractive
19+
20+
###########################################
21+
# Helper Functions
22+
###########################################
23+
24+
apt-get-update() {
25+
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
26+
echo "Running apt-get update..."
27+
apt-get update -y
28+
fi
29+
}
30+
31+
# Checks if packages are installed and installs them if not
32+
check-packages() {
33+
if ! dpkg -s "$@" >/dev/null 2>&1; then
34+
apt-get-update
35+
apt-get -y install --no-install-recommends "$@"
36+
fi
37+
}
38+
39+
###########################################
40+
# Install Feature
41+
###########################################
42+
43+
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor >microsoft.gpg
44+
mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
45+
46+
sh -c 'echo "deb [arch=$(dpkg --print-architecture)] https://packages.microsoft.com/debian/$(lsb_release -rs | cut -d'.' -f 1)/prod $(lsb_release -cs) main" > /etc/apt/sources.list.d/dotnetdev.list'
47+
48+
check-packages \
49+
poppler-utils \
50+
azure-functions-core-tools-4 \
51+
libsecret-1-0
52+
53+
echo 'dev-tools script has completed!'

.devcontainer/post-create.sh

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
3+
USERNAME=${USERNAME:-"vscode"}
4+
5+
set -eux
6+
7+
# Setup STDERR.
8+
err() {
9+
echo "(!) $*" >&2
10+
}
11+
12+
# Ensure apt is in non-interactive to avoid prompts
13+
export DEBIAN_FRONTEND=noninteractive
14+
15+
# Install Python dependencies
16+
pip --disable-pip-version-check --no-cache-dir install --user -r src/AIDocumentPipeline/requirements.txt

.vscode/extensions.json

+22-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,30 @@
11
{
22
"recommendations": [
3+
"GitHub.remotehub",
4+
"GitHub.copilot",
5+
"GitHub.copilot-chat",
6+
"github.vscode-pull-request-github",
7+
"GitHub.vscode-github-actions",
8+
"ms-azuretools.azure-dev",
9+
"ms-azuretools.vscode-bicep",
10+
"ms-azuretools.vscode-docker",
11+
"ms-azuretools.vscode-azureresourcegroups",
312
"ms-azuretools.vscode-azurefunctions",
13+
"ms-azuretools.vscode-azure-github-copilot",
414
"ms-python.python",
15+
"ms-python.debugpy",
16+
"ms-python.vscode-pylance",
17+
"ms-python.autopep8",
518
"ms-vscode.vscode-node-azure-pack",
6-
"ms-azuretools.vscode-bicep",
19+
"ms-vscode.powershell",
20+
"ms-vscode-remote.vscode-remote-extensionpack",
21+
"ms-vscode-remote.remote-containers",
22+
"Azurite.azurite",
723
"DurableFunctionsMonitor.durablefunctionsmonitor",
8-
"EditorConfig.EditorConfig",
24+
"esbenp.prettier-vscode",
925
"humao.rest-client",
10-
"ms-azuretools.vscode-docker",
11-
"ms-vscode-remote.remote-containers",
12-
"Azurite.azurite"
26+
"VisualStudioExptTeam.vscodeintellicode",
27+
"eamodio.gitlens",
28+
"EditorConfig.EditorConfig"
1329
]
14-
}
30+
}

src/AIDocumentPipeline/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# To enable ssh & remote debugging on app service change the base image to the one below
2-
# FROM mcr.microsoft.com/azure-functions/python:4-python3.11-appservice
3-
FROM mcr.microsoft.com/azure-functions/python:4-python3.11
2+
# FROM mcr.microsoft.com/azure-functions/python:4-python3.12-appservice
3+
FROM mcr.microsoft.com/azure-functions/python:4-python3.12
44

55
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
66
AzureFunctionsJobHost__Logging__Console__IsEnabled=true

0 commit comments

Comments
 (0)