Skip to content
Draft
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
12 changes: 8 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,20 @@ jobs:
uses: actions/checkout@v4

- name: Set up Python
uses: pdm-project/setup-pdm@v4
uses: actions/setup-python@v5
with:
python-version: "3.13"
cache: true

- name: Install UV
uses: astral-sh/setup-uv@v5
with:
enable-cache: true

- name: Install dependencies
run: pdm install --check
run: uv sync --frozen

- name: Run tests
run: pdm run pytest
run: uv run pytest

build-and-push:
runs-on: ubuntu-latest
Expand Down
20 changes: 13 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
FROM python:3.13-slim AS build-env
RUN apt-get update && apt-get -y install git
RUN pip install --upgrade pip setuptools wheel
RUN pip install pdm
RUN apt-get update && apt-get -y install git curl

# Install UV
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
ENV PATH="/root/.local/bin:${PATH}"

COPY pyproject.toml pdm.lock README.md /app/
COPY pyproject.toml uv.lock README.md /app/

WORKDIR /app

RUN mkdir __pypackages__ && pdm sync --prod --no-editable
# Use UV to sync production dependencies from lockfile
# This is the native UV way to install from a lockfile
RUN uv sync --frozen --no-dev --no-install-project

# The dependencies are installed in .venv, so we need to copy them
RUN cp -r /app/.venv/lib/python*/site-packages /app/__pypackages__

COPY src/ /app/src

FROM python:3.13-slim
RUN apt-get update && apt-get -y install git

COPY --from=build-env /app/__pypackages__/3.13/lib /app/pkgs
COPY --from=build-env /app/__pypackages__/3.13/bin /app/bin/
COPY --from=build-env /app/__pypackages__ /app/pkgs
COPY --from=build-env /app/src /app/src

RUN adduser --system --no-create-home --uid 1000 nonroot
Expand Down
Loading