Skip to content

Commit 7edbf4f

Browse files
committed
Rework docker and CI to use uv
1 parent 26757f4 commit 7edbf4f

3 files changed

Lines changed: 45 additions & 27 deletions

File tree

.github/workflows/BuildDocker.yml

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,37 @@ jobs:
99
name: Deploy Docker image
1010
runs-on: ubuntu-22.04
1111
steps:
12-
# Actually build the Docker container
13-
- uses: actions/checkout@v3
14-
- uses: docker/setup-buildx-action@v1
12+
- uses: actions/checkout@v4
13+
- uses: docker/setup-buildx-action@v3
14+
15+
- name: Cache Docker layers
16+
uses: actions/cache@v4
17+
with:
18+
path: /tmp/.buildx-cache
19+
key: ${{ runner.os }}-buildx-${{ github.sha }}
20+
restore-keys: |
21+
${{ runner.os }}-buildx-
22+
1523
- name: GHCR Log-in
16-
uses: docker/login-action@v1
24+
uses: docker/login-action@v3
1725
with:
1826
registry: ghcr.io
1927
username: ${{ github.actor }}
2028
password: ${{ secrets.GITHUB_TOKEN }}
29+
2130
- name: Build and push
22-
uses: docker/build-push-action@v2
31+
uses: docker/build-push-action@v5
2332
with:
2433
context: .
2534
file: Container/Dockerfile
2635
push: true
2736
# JUNGVI: If you operate from a fork and want to build a new docker make sure to replace 'pulp-platform' by your uname.
28-
tags: ghcr.io/pulp-platform/deepquant:main
37+
tags: ghcr.io/pulp-platform/deepquant:main
38+
cache-from: type=local,src=/tmp/.buildx-cache
39+
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
40+
41+
# Prevent cache from growing indefinitely
42+
- name: Move cache
43+
run: |
44+
rm -rf /tmp/.buildx-cache
45+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

.github/workflows/CI.yml

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ jobs:
2121
uses: actions/checkout@v4
2222
with:
2323
submodules: recursive
24-
- name: Build DeepQuant
24+
- name: Sync dependencies and install DeepQuant
2525
run: |
26-
python -m pip install --upgrade pip
27-
pip install -e .
26+
uv sync --frozen
27+
uv pip install -e .
2828
2929
single-layer-tests:
3030
runs-on: ubuntu-latest
@@ -35,31 +35,27 @@ jobs:
3535
uses: actions/checkout@v4
3636
with:
3737
submodules: recursive
38-
- name: Build DeepQuant
38+
- name: Sync dependencies and install DeepQuant
3939
run: |
40-
python -m pip install --upgrade pip
41-
pip install -e .
40+
uv sync --frozen
41+
uv pip install -e .
4242
- name: Run Tests
4343
run: |
4444
pytest -m SingleLayerTests
4545
4646
model-tests:
4747
runs-on: ubuntu-latest
48-
# container:
49-
# image: ghcr.io/pulp-platform/deepquant:main
48+
container:
49+
image: ghcr.io/pulp-platform/deepquant:main
5050
steps:
5151
- name: Checkout Repo
5252
uses: actions/checkout@v4
5353
with:
5454
submodules: recursive
55-
- name: Set up Python
56-
uses: actions/setup-python@v5
57-
with:
58-
python-version: '3.11'
59-
- name: Build DeepQuant
55+
- name: Sync dependencies and install DeepQuant
6056
run: |
61-
python -m pip install --upgrade pip
62-
pip install -e .
57+
uv sync --frozen
58+
uv pip install -e .
6359
- name: Run Tests
6460
run: |
6561
pytest -m ModelTests -s

Container/Dockerfile

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,18 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
55
git \
66
curl \
77
ca-certificates \
8-
&& rm -rf /var/lib/apt/lists/*
8+
&& rm -rf /var/lib/apt/lists/* \
9+
&& pip install --no-cache-dir uv
910

1011
WORKDIR /app
1112

12-
COPY pyproject.toml .
13+
COPY pyproject.toml uv.lock .python-version ./
1314

14-
RUN pip install --upgrade pip setuptools wheel && \
15-
pip install toml-to-requirements && \
16-
toml-to-req --toml-file pyproject.toml && \
17-
pip install -r requirements.txt
15+
RUN uv venv /opt/venv \
16+
&& uv sync --frozen --no-dev \
17+
&& uv cache clean
18+
19+
ENV VIRTUAL_ENV=/opt/venv
20+
ENV PATH="/opt/venv/bin:$PATH"
21+
22+
WORKDIR /workspace

0 commit comments

Comments
 (0)