Skip to content

Commit 7a77dcc

Browse files
authored
Merge pull request #23 from pamelafox/dockerbuild
Improve the prebuilds with a Dockerfile
2 parents 0c261dd + fac9f18 commit 7a77dcc

File tree

6 files changed

+32
-23
lines changed

6 files changed

+32
-23
lines changed

.devcontainer/Dockerfile

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM mcr.microsoft.com/devcontainers/python:3.12-bookworm
2+
3+
COPY requirements-dev.txt /tmp/pip-tmp/
4+
COPY requirements.txt /tmp/pip-tmp/
5+
COPY requirements-rag.txt /tmp/pip-tmp/
6+
7+
RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements-dev.txt \
8+
&& rm -rf /tmp/pip-tmp

.devcontainer/devcontainer.json

+5-8
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/python-3
33
{
44
"name": "python-openai-demos (Azure OpenAI)",
5-
"image": "mcr.microsoft.com/devcontainers/python:3.11-bullseye",
6-
5+
"build": {
6+
"dockerfile": "Dockerfile",
7+
"context": ".."
8+
},
79
"features": {
810
"ghcr.io/devcontainers/features/azure-cli:latest": {},
911
"ghcr.io/azure/azure-dev/azd:latest": {}
@@ -19,16 +21,11 @@
1921

2022
// Add the IDs of extensions you want installed when the container is created.
2123
"extensions": [
22-
"ms-python.python",
23-
"charliermarsh.ruff",
24-
"ms-python.black-formatter"
24+
"ms-python.python"
2525
]
2626
}
2727
},
2828

29-
// Use 'postCreateCommand' to run commands after the container is created.
30-
"postCreateCommand": "pip3 install --user -r requirements-dev.txt",
31-
3229
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
3330
"remoteUser": "vscode"
3431
}

.devcontainer/github/devcontainer.json

+6-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/python-3
33
{
44
"name": "python-openai-demos (GitHub models)",
5-
"image": "mcr.microsoft.com/devcontainers/python:3.11-bullseye",
5+
"build": {
6+
"dockerfile": "Dockerfile",
7+
"context": ".."
8+
},
69
"features": {
710
},
811
// Configure tool-specific properties.
@@ -16,15 +19,13 @@
1619

1720
// Add the IDs of extensions you want installed when the container is created.
1821
"extensions": [
19-
"ms-python.python",
20-
"charliermarsh.ruff",
21-
"ms-python.black-formatter"
22+
"ms-python.python"
2223
]
2324
}
2425
},
2526

2627
// Use 'postCreateCommand' to run commands after the container is created.
27-
"postCreateCommand": "pip3 install --user -r requirements-dev.txt && cp .env.sample.github .env",
28+
"postCreateCommand": "cp .env.sample.github .env",
2829

2930
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
3031
"remoteUser": "vscode"

.devcontainer/ollama/devcontainer.json

+6-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/python-3
33
{
44
"name": "python-openai-demos (Ollama)",
5-
"image": "mcr.microsoft.com/devcontainers/python:3.11-bullseye",
5+
"build": {
6+
"dockerfile": "Dockerfile",
7+
"context": ".."
8+
},
69
"features": {
710
"ghcr.io/prulloac/devcontainer-features/ollama:1": {}
811
},
@@ -17,15 +20,13 @@
1720

1821
// Add the IDs of extensions you want installed when the container is created.
1922
"extensions": [
20-
"ms-python.python",
21-
"charliermarsh.ruff",
22-
"ms-python.black-formatter"
23+
"ms-python.python"
2324
]
2425
}
2526
},
2627

2728
// Use 'postCreateCommand' to run commands after the container is created.
28-
"postCreateCommand": "pip3 install --user -r requirements-dev.txt && cp .env.sample.ollama .env && ollama pull llama3.1",
29+
"postCreateCommand": "cp .env.sample.ollama .env && ollama pull llama3.1",
2930

3031
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
3132
"remoteUser": "vscode",

.devcontainer/openai/devcontainer.json

+6-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/python-3
33
{
44
"name": "python-openai-demos (OpenAI.com)",
5-
"image": "mcr.microsoft.com/devcontainers/python:3.11-bullseye",
5+
"build": {
6+
"dockerfile": "Dockerfile",
7+
"context": ".."
8+
},
69
// Configure tool-specific properties.
710
"customizations": {
811
// Configure properties specific to VS Code.
@@ -14,15 +17,13 @@
1417

1518
// Add the IDs of extensions you want installed when the container is created.
1619
"extensions": [
17-
"ms-python.python",
18-
"charliermarsh.ruff",
19-
"ms-python.black-formatter"
20+
"ms-python.python"
2021
]
2122
}
2223
},
2324

2425
// Use 'postCreateCommand' to run commands after the container is created.
25-
"postCreateCommand": "pip3 install --user -r requirements-dev.txt && cp .env.sample.openai .env",
26+
"postCreateCommand": "cp .env.sample.openai .env",
2627

2728
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
2829
"remoteUser": "vscode"

requirements-dev.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
-r requirements.txt
2+
-r requirements-rag.txt
23
pre-commit
34
ruff
45
black

0 commit comments

Comments
 (0)