Skip to content

Commit b951d41

Browse files
author
7908837174
committed
1024
1 parent 1757c94 commit b951d41

File tree

4 files changed

+28
-18
lines changed

4 files changed

+28
-18
lines changed

.devcontainer/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@ RUN \
4242
ruby-dev \
4343
shellcheck
4444

45-
# Fix PEP 668 issue by using --break-system-packages flag
46-
RUN pip3 install --break-system-packages -r /workspace/requirements.txt
45+
# Create a virtual environment and install Python requirements
46+
RUN python3 -m venv /opt/venv
47+
ENV PATH="/opt/venv/bin:$PATH"
48+
RUN pip install -r /workspace/requirements.txt
4749

4850
RUN apt-get clean autoclean
4951
RUN apt-get autoremove -y

.devcontainer/onCreateCommand.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@
33
npm i
44
bundle install --verbose
55

6-
# Install Python packages with --break-system-packages flag to avoid PEP 668 error
7-
pip3 install --break-system-packages -r requirements.txt
6+
# Create a virtual environment and install Python requirements
7+
python3 -m venv .venv
8+
source .venv/bin/activate
9+
pip install -r requirements.txt

.devcontainer/updateContentCommand.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@
22

33
bundle install --verbose
44

5-
# Install Python packages with --break-system-packages flag to avoid PEP 668 error
6-
pip3 install --break-system-packages -r requirements.txt
5+
# Create a virtual environment and install Python requirements
6+
python3 -m venv .venv
7+
source .venv/bin/activate
8+
pip install -r requirements.txt

tests/container_tests.sh

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,28 @@ docker run --rm riscv-unified-db-test ruby --version
1919
docker run --rm riscv-unified-db-test python3 --version
2020
docker run --rm riscv-unified-db-test npm --version
2121

22-
# Test 3: Check if we can install Python packages
23-
echo "Test 3: Installing Python packages..."
24-
docker run --rm -v $(pwd):/workspace riscv-unified-db-test pip3 install --break-system-packages -r /workspace/requirements.txt
22+
# Test 3: Check if we can install Python packages in a virtual environment
23+
echo "Test 3: Installing Python packages in virtual environment..."
24+
docker run --rm -v $(pwd):/workspace riscv-unified-db-test bash -c "cd /workspace && python3 -m venv .venv && source .venv/bin/activate && pip install -r requirements.txt"
2525

26-
# Test 4: Check if we can install gems
27-
echo "Test 4: Installing gems..."
26+
# Test 4: Check if we can install Python packages with --break-system-packages flag
27+
echo "Test 4: Installing Python packages with --break-system-packages flag..."
28+
docker run --rm -v $(pwd):/workspace riscv-unified-db-test bash -c "cd /workspace && pip3 install --break-system-packages -r requirements.txt"
29+
30+
# Test 5: Check if we can install gems
31+
echo "Test 5: Installing gems..."
2832
docker run --rm riscv-unified-db-test gem list bundler
2933

30-
# Test 5: Check if we can run rake tasks
31-
echo "Test 5: Running rake tasks..."
34+
# Test 6: Check if we can run rake tasks
35+
echo "Test 6: Running rake tasks..."
3236
docker run --rm -v $(pwd):/workspace riscv-unified-db-test rake --version
3337

34-
# Test 6: Check non-root user exists
35-
echo "Test 6: Checking non-root user..."
38+
# Test 7: Check non-root user exists
39+
echo "Test 7: Checking non-root user..."
3640
docker run --rm riscv-unified-db-test id -u vscode
3741

38-
# Test 7: Proxy configuration test
39-
echo "Test 7: Checking proxy configuration..."
42+
# Test 8: Proxy configuration test
43+
echo "Test 8: Checking proxy configuration..."
4044
if [ -n "$http_proxy" ] || [ -n "$https_proxy" ]; then
4145
echo "Proxy is configured: HTTP_PROXY=$http_proxy, HTTPS_PROXY=$https_proxy"
4246
# Test proxy connectivity if configured
@@ -45,4 +49,4 @@ else
4549
echo "No proxy configured"
4650
fi
4751

48-
echo "All container tests passed!"
52+
echo "All container tests passed!"

0 commit comments

Comments
 (0)