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
13 changes: 12 additions & 1 deletion .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,19 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Free disk space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true

- name: Build Docker image
run: docker build -t image -f dockerfiles/Dockerfile .

- name: Run pytest on image
run: docker run image poetry run pytest
run: docker run image pytest
15 changes: 7 additions & 8 deletions dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@ FROM python:3.13-slim
# Set the working directory in the container
WORKDIR /app

# Install poetry
RUN pip install --no-cache-dir poetry poetry-plugin-export

# Copy the dependency files to the working directory
COPY pyproject.toml poetry.lock ./

# Using poetry to make a requirements.txt then pip to do the install.
# Pip is aggressive with storage space.
RUN poetry export -f requirements.txt -o requirements.txt --without-hashes --with dev

RUN pip install --no-cache-dir -r requirements.txt \
# Install poetry, export requirements, install deps with CPU-only PyTorch,
# then clean up poetry -- all in one layer to minimize image size.
RUN pip install --no-cache-dir poetry poetry-plugin-export \
&& poetry export -f requirements.txt -o requirements.txt --without-hashes --with dev \
&& pip install --no-cache-dir -r requirements.txt \
--extra-index-url https://download.pytorch.org/whl/cpu \
&& pip uninstall -y poetry poetry-plugin-export \
&& rm requirements.txt

# Copy the rest of the application code to the working directory
Expand Down