Skip to content

Commit d83745f

Browse files
committed
use uv in dockerfiles
1 parent cf11eac commit d83745f

File tree

6 files changed

+28
-16
lines changed

6 files changed

+28
-16
lines changed

.github/actions/compose/action.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,3 @@ runs:
1414
sudo apt-get update
1515
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
1616
shell: bash
17-
- run: pip install --upgrade pip
18-
shell: bash
19-
- run: pip install -e .
20-
shell: bash

.github/actions/k8s/action.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,10 @@ runs:
1717
docker image ls -a
1818
1919
echo Installing warnet python package for cli
20-
pip install --upgrade pip
21-
pip install -e .
20+
uv pip install --system --no-cache -r requirements.txt
21+
uv pip install --system --no-cache -e .
2222
23-
echo patching k8s configs to use local image
24-
echo Patching warnet-rpc-statefulset-dev to use local registry
25-
sed -i "s|imagePullPolicy: Always|imagePullPolicy: Never|g" src/templates/rpc/warnet-rpc-statefulset-dev.yaml
26-
sed -i "s|bitcoindevproject/warnet-rpc:dev|local/warnet-rpc:ci|g" src/templates/rpc/warnet-rpc-statefulset-dev.yaml
23+
echo "Using warnet-rpc-statefulset-dev.yaml:"
2724
cat src/templates/rpc/warnet-rpc-statefulset-dev.yaml
2825
2926
echo Setting up k8s

.github/workflows/test.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ jobs:
4646
test: [scenarios_test.py, rpc_test.py, graph_test.py, ln_test.py, get_service_ip_test.py]
4747
steps:
4848
- uses: actions/checkout@v4
49+
- uses: hynek/setup-cached-uv@v1
4950
- if: matrix.backend == 'compose'
5051
uses: ./.github/actions/compose
5152
- if: matrix.backend == 'k8s'
@@ -54,11 +55,18 @@ jobs:
5455
run: |
5556
kubectl port-forward svc/rpc 9276:9276 &
5657
- name: Run tests
57-
run: ./test/${{matrix.test}} ${{matrix.backend}}
58+
run: |
59+
uv venv
60+
uv pip install .
61+
uv test/${{matrix.test}} ${{matrix.backend}}
5862
build-test:
5963
needs: [build-image]
6064
runs-on: ubuntu-latest
6165
steps:
6266
- uses: actions/checkout@v4
67+
- uses: hynek/setup-cached-uv@v1
6368
- uses: ./.github/actions/compose
64-
- run: ./test/build_branch_test.py compose
69+
- run: |
70+
uv venv
71+
uv pip install .
72+
uv run test/build_branch_test.py compose

src/templates/rpc/Dockerfile_rpc

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
11
# Use an official Python runtime as the base image
2-
FROM python:3.11-slim
2+
FROM python:3.12-slim
33

44
# Install procps, which includes pgrep
55
RUN apt-get update && \
66
apt-get install -y procps openssh-client && \
77
rm -rf /var/lib/apt/lists/*
88

9+
# Install `uv` packge installer (https://github.com/astral-sh/uv)
10+
RUN pip install uv
11+
912
# Set the working directory in the container
1013
WORKDIR /root/warnet
1114

15+
# Get better caching by installing before copying code
16+
COPY requirements.txt .
17+
RUN uv pip install --system -r requirements.txt
18+
1219
# Copy the source directory contents into the container
1320
COPY . /root/warnet
14-
RUN pip install .
21+
# Install Warnet scripts
22+
RUN uv pip install --system .
1523

1624
# Make port 9276 available to the world outside this container
1725
# Change the port if your server is running on a different port

src/templates/rpc/Dockerfile_rpc_dev

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
# Use an official Python runtime as the base image
2-
FROM python:3.11-slim
2+
FROM python:3.12-slim
33

44
# Install procps, which includes pgrep
55
RUN apt-get update && \
66
apt-get install -y procps openssh-client && \
77
rm -rf /var/lib/apt/lists/*
88

9+
# Install `uv` packge installer (https://github.com/astral-sh/uv)
10+
RUN pip install uv
11+
912
# Set the working directory in the container
1013
WORKDIR /root/warnet
1114

src/templates/rpc/entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ done
3131
if check_setup_toml; then
3232
echo "Installing package from ${SOURCE_DIR}..."
3333
cd ${SOURCE_DIR}
34-
pip install -e .
34+
uv pip install --system -e .
3535
fi
3636

3737
# Execute the CMD from the Dockerfile

0 commit comments

Comments
 (0)