Skip to content

Commit 722aeb5

Browse files
chore(devcontainer): add multi-arch dev container (x86_64/arm64) with essential tools and VS Code config
1 parent 8e53032 commit 722aeb5

File tree

3 files changed

+99
-0
lines changed

3 files changed

+99
-0
lines changed

.devcontainer/.dockerignore

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
**/.git
2+
**/.gitignore
3+
**/.vscode
4+
**/.idea
5+
**/.DS_Store
6+
**/.pytest_cache
7+
**/.mypy_cache
8+
**/.ruff_cache
9+
**/__pycache__
10+
**/*.pyc
11+
**/*.pyo
12+
**/*.pyd
13+
**/.Python
14+
**/pip-log.txt
15+
**/pip-delete-this-directory.txt
16+
**/.venv
17+
**/venv
18+
**/ENV
19+
**/env
20+
**/.coverage
21+
**/.coverage.*
22+
**/htmlcov
23+
**/coverage.xml
24+
**/*.cover
25+
**/*.log
26+
**/.hypothesis
27+
**/dist
28+
**/build
29+
**/*.egg-info
30+
**/node_modules

.devcontainer/Containerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
FROM python:3.13-slim
2+
3+
ARG USERNAME=vscode
4+
ARG USER_UID=1000
5+
ARG USER_GID=$USER_UID
6+
7+
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
8+
&& apt-get -y install --no-install-recommends \
9+
git \
10+
curl \
11+
wget \
12+
build-essential \
13+
sudo \
14+
libffi-dev \
15+
&& groupadd --gid $USER_GID $USERNAME \
16+
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
17+
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
18+
&& chmod 0440 /etc/sudoers.d/$USERNAME \
19+
&& apt-get clean \
20+
&& rm -rf /var/lib/apt/lists/*
21+
22+
USER $USERNAME
23+
24+
RUN pip install --user pipx \
25+
&& python -m pipx ensurepath
26+
27+
ENV PATH="/home/${USERNAME}/.local/bin:${PATH}"
28+
29+
RUN pipx install hatch \
30+
&& pipx install uv
31+
32+
WORKDIR /workspace
33+
34+
CMD ["/bin/bash"]

.devcontainer/devcontainer.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "Pact Python Development",
3+
"build": {
4+
"dockerfile": "Containerfile",
5+
"context": ".."
6+
},
7+
"customizations": {
8+
"vscode": {
9+
"extensions": [
10+
"ms-python.python",
11+
"ms-python.vscode-pylance",
12+
"charliermarsh.ruff"
13+
],
14+
"settings": {
15+
"python.defaultInterpreterPath": "/usr/local/bin/python3",
16+
"python.testing.pytestEnabled": true,
17+
"python.testing.pytestArgs": ["tests/"],
18+
"editor.formatOnSave": true,
19+
"editor.codeActionsOnSave": {
20+
"source.organizeImports": "explicit"
21+
},
22+
"[python]": {
23+
"editor.defaultFormatter": "charliermarsh.ruff"
24+
}
25+
}
26+
}
27+
},
28+
"containerEnv": {
29+
"PYTHONUNBUFFERED": "1"
30+
},
31+
"postCreateCommand": "git submodule update --init && hatch env create",
32+
"remoteUser": "vscode",
33+
"workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached",
34+
"workspaceFolder": "/workspace"
35+
}

0 commit comments

Comments
 (0)