From ac7e52a44203ef78f46207f7a4210725fee3ce89 Mon Sep 17 00:00:00 2001 From: Daniel Plank Date: Mon, 9 Nov 2026 16:32:59 +0100 Subject: [PATCH] Containerize with Docker Compose Fix numpy pin for Python 3.11: the originally pinned numpy==2.5.4 requires Python >=3.12, which is incompatible with the python:3.11-slim base image. Refs #9 --- Dockerfile | 22 ++++++++++++++++++++++ docker-compose.yml | 27 +++++++++++++++++++++++++++ requirements.txt | 2 +- 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..12467f0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM python:3.11-slim + +WORKDIR /app + +ENV PYTHONDONTWRITEBYTECODE=1 \ + PYTHONUNBUFFERED=1 \ + HF_HUB_DISABLE_SYMLINKS_WARNING=1 + +# Install CPU-only torch first (sentence-transformers' default install otherwise pulls the +# much larger CUDA-enabled build, which is unnecessary for this CPU-only prototype). +RUN pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu + +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt + +COPY app/ app/ +COPY ui/ ui/ +COPY eval/ eval/ + +EXPOSE 8501 + +CMD ["streamlit", "run", "ui/streamlit_app.py", "--server.address=0.0.0.0", "--server.port=8501"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..b1d8b33 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,27 @@ +services: + ollama: + image: ollama/ollama:latest + container_name: policy-assistant-ollama + ports: + - "11434:11434" + volumes: + - ollama_models:/root/.ollama + restart: unless-stopped + + app: + build: . + container_name: policy-assistant-app + depends_on: + - ollama + environment: + OLLAMA_MODEL: ${OLLAMA_MODEL:-llama3.2:3b} + OLLAMA_BASE_URL: http://ollama:11434 + ports: + - "8501:8501" + volumes: + - app_data:/app/app/data + restart: unless-stopped + +volumes: + ollama_models: + app_data: diff --git a/requirements.txt b/requirements.txt index fb8fd47..96f64bb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,4 +10,4 @@ streamlit==1.67.0 pydantic==2.14.3 python-dotenv==1.2.4 pytest==9.2.0 -numpy==2.5.4 +numpy==2.4.6