From 1c62e88cbd896d4c2598996c095cc67e0bb0dd19 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Wed, 3 Jun 2026 08:22:17 -0400 Subject: [PATCH] feat(docker): add Dockerfile and .dockerignore for containerized deployment --- .dockerignore | 4 ++++ Dockerfile | 39 ++++++++++++++------------------------- 2 files changed, 18 insertions(+), 25 deletions(-) diff --git a/.dockerignore b/.dockerignore index 94a45cc0..8c3da399 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,7 @@ +tests/artifacts +tests/logs +.ruff_cache +.mypy_cache .venv __pycache__ *.pyc diff --git a/Dockerfile b/Dockerfile index 4ddf3302..6d3cfe66 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,34 +1,23 @@ -# Use python:3.11-slim as a base FROM python:3.11-slim -# Set environment variables -# UV_SYSTEM_PYTHON=1 allows uv to install into the system site-packages -ENV PYTHONDONTWRITEBYTECODE=1 - PYTHONUNBUFFERED=1 - UV_SYSTEM_PYTHON=1 +RUN apt-get update && apt-get install -y --no-install-recommends \ + git curl ca-certificates \ + && rm -rf /var/lib/apt/lists/* -# Install system dependencies and uv -RUN apt-get update && apt-get install -y --no-install-recommends - curl - ca-certificates - && rm -rf /var/lib/apt/lists/* - && curl -LsSf https://astral.sh/uv/install.sh | sh - && mv /root/.local/bin/uv /usr/local/bin/uv +RUN pip install uv -# Set the working directory in the container WORKDIR /app +COPY pyproject.toml uv.lock ./ +RUN uv sync --frozen -# Copy dependency files first to leverage Docker layer caching -COPY pyproject.toml requirements.txt* ./ - -# Install dependencies via uv -RUN if [ -f requirements.txt ]; then uv pip install --no-cache -r requirements.txt; fi - -# Copy the rest of the application code COPY . . -# Expose port 8000 for the headless API/service -EXPOSE 8000 +RUN mkdir -p /projects /config +VOLUME ["/projects", "/config"] -# Set the entrypoint to run the app in headless mode -ENTRYPOINT ["python", "gui_2.py", "--headless"] +EXPOSE 8080 8999 + +HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \ + CMD curl -f http://127.0.0.1:8999/status || exit 1 + +ENTRYPOINT ["uv", "run", "sloppy.py", "--enable-test-hooks", "--web-host=0.0.0.0", "--web-port=8080"] \ No newline at end of file