-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add devcontainer for Python environment (#339)
* feat: Add devcontainer for python * refactor: move devcontainer related files --------- Co-authored-by: Adam Hendel <[email protected]>
- Loading branch information
1 parent
e0c8956
commit a1dfcd0
Showing
3 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
FROM python:3.9 | ||
|
||
# Install necessary system dependencies | ||
RUN apt-get update && apt-get install -y \ | ||
git \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Create a non-root user | ||
ARG USERNAME=vscode | ||
ARG USER_UID=1000 | ||
ARG USER_GID=$USER_UID | ||
|
||
RUN groupadd --gid $USER_GID $USERNAME \ | ||
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ | ||
&& apt-get update \ | ||
&& apt-get install -y sudo \ | ||
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ | ||
&& chmod 0440 /etc/sudoers.d/$USERNAME | ||
|
||
# Set the default user | ||
USER $USERNAME | ||
|
||
# Set the working directory | ||
WORKDIR /workspace | ||
|
||
# Install any global packages you need here | ||
RUN pip install --upgrade pip | ||
|
||
# Install poetry and add it to the PATH | ||
RUN pip install --user poetry | ||
|
||
# We don't need to copy the project files here, as they will be mounted by VS Code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"name": "Python 3.9+ Development Container", | ||
"dockerComposeFile": [ | ||
"docker-compose.devcontainer.yml" | ||
], | ||
"containerEnv": { | ||
"POSTGRES_PASSWORD": "postgres", | ||
"SQLALCHEMY_HOST": "pgmq-postgres" | ||
}, | ||
"service": "tembo-pgmq-python", | ||
"mounts": [ | ||
"source=${localWorkspaceFolder}/tembo-pgmq-python,target=/workspace/tembo-pgmq-python,type=bind,consistency=cached" | ||
], | ||
"workspaceFolder": "/workspace/tembo-pgmq-python", | ||
"postCreateCommand": "poetry install --all-extras", | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"ms-python.python", | ||
"ms-python.vscode-pylance" | ||
] | ||
}, | ||
"settings": { | ||
"terminal.integrated.defaultProfile.linux": "bash", | ||
"terminal.integrated.profiles.linux": { | ||
"bash": { | ||
"path": "bash", | ||
"icon": "terminal-bash" | ||
} | ||
} | ||
} | ||
}, | ||
"remoteUser": "vscode" | ||
} |
26 changes: 26 additions & 0 deletions
26
.devcontainer/tembo-pgmq-python/docker-compose.devcontainer.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
version: "3" | ||
services: | ||
pgmq-postgres: | ||
image: quay.io/tembo/pg16-pgmq:latest | ||
container_name: pgmq-postgres | ||
ports: | ||
- "5432:5432" | ||
environment: | ||
- POSTGRES_PASSWORD=postgres | ||
command: ["-c", "max_connections=20000"] # for running tests parallel | ||
volumes: | ||
- ./pgmq-extension/sql/pgmq.sql:/docker-entrypoint-initdb.d/db.sql | ||
networks: | ||
- tembo-pgmq-network | ||
tembo-pgmq-python: | ||
build: | ||
context: ../../tembo-pgmq-python | ||
dockerfile: ../.devcontainer/tembo-pgmq-python/devcontainer.Dockerfile | ||
image: tembo-pgmq-python | ||
container_name: tembo-pgmq-python | ||
networks: | ||
- tembo-pgmq-network | ||
command: ["tail", "-f", "/dev/null"] | ||
networks: | ||
tembo-pgmq-network: | ||
driver: bridge |