Skip to content
Merged
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
15 changes: 8 additions & 7 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,12 @@ RUN groupadd $USERNAME \
&& useradd -g $USERNAME -m $USERNAME \
&& echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

# Create venv using uv
RUN uv venv /opt/venv --python 3.11 \
&& chown -R vscode:vscode /opt/venv \
&& ls -la /opt/venv/bin/activate
ENV PATH="/opt/venv/bin:$PATH"
# Remove any existing venv and create fresh uv venv
RUN rm -rf /opt/pyrit-dev \
&& uv venv /opt/pyrit-dev --python 3.11 \
&& chown -R vscode:vscode /opt/pyrit-dev \
&& ls -la /opt/pyrit-dev/bin/activate
ENV PATH="/opt/pyrit-dev/bin:$PATH"

# Pre-create common user caches and fix permissions
RUN mkdir -p /home/vscode/.cache/pre-commit \
Expand All @@ -74,8 +75,8 @@ RUN mkdir -p /home/vscode/.cache/pre-commit \
USER vscode
# Create bash configuration files and activate the venv in bash sessions
RUN touch /home/vscode/.bashrc /home/vscode/.bash_profile \
&& echo "[ -f /opt/venv/bin/activate ] && source /opt/venv/bin/activate" >> /home/vscode/.bashrc \
&& echo "[ -f /opt/venv/bin/activate ] && source /opt/venv/bin/activate" >> /home/vscode/.bash_profile
&& echo "[ -f /opt/pyrit-dev/bin/activate ] && source /opt/pyrit-dev/bin/activate" >> /home/vscode/.bashrc \
&& echo "[ -f /opt/pyrit-dev/bin/activate ] && source /opt/pyrit-dev/bin/activate" >> /home/vscode/.bash_profile

# Configure Git for better performance with bind mounts
RUN git config --global core.preloadindex true \
Expand Down
5 changes: 3 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"customizations": {
"vscode": {
"settings": {
"python.defaultInterpreterPath": "/opt/venv/bin/python",
"terminal.integrated.defaultProfile.linux": "bash",
"python.defaultInterpreterPath": "/opt/pyrit-dev/bin/python",
"python.analysis.extraPaths": [
"/workspace"
],
Expand All @@ -32,7 +33,7 @@
"pyrit/**"
],
"python.analysis.exclude": [
"/opt/venv/**",
"/opt/pyrit-dev/**",
"**/.venv/**",
"**/site-packages/**",
"**/doc/**",
Expand Down
4 changes: 2 additions & 2 deletions .devcontainer/devcontainer_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ if [ -f "$HASH_FILE" ]; then
chmod 666 "$HASH_FILE"
fi

uv venv /opt/venv --python 3.11 \
&& . /opt/venv/bin/activate
# Activate the uv venv created in the Dockerfile
source /opt/pyrit-dev/bin/activate

# Compute current hash
CURRENT_HASH=$(sha256sum /workspace/pyproject.toml | awk '{print $1}')
Expand Down
2 changes: 0 additions & 2 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ services:
memory: "16G"
volumes:
- ..:/workspace:delegated
- pyrit-env:/opt/venv:cached
- pip-cache:/home/vscode/.cache/pip:cached
- uv-cache:/home/vscode/.cache/uv:cached
- precommit-cache:/home/vscode/.cache/pre-commit:cached
Expand All @@ -24,7 +23,6 @@ services:
command: "sleep infinity"

volumes:
pyrit-env:
pip-cache:
uv-cache:
precommit-cache:
Expand Down