From ea95107ce7f923f2ac8c1cba3b5adbe3bd5bb3a5 Mon Sep 17 00:00:00 2001 From: s-heppner Date: Mon, 10 Mar 2025 18:30:55 +0100 Subject: [PATCH] Fix docker container definition After the major refactor, the Dockerfile was broken. This fixes it, and adapts it to use Python version 3.11 at the same time (as defined in the `pyproject.toml`). Furthermore, this adds a `compose.yaml` for easier deployment. Sadly, however, this introduces #15, as currently we cannot run the container directly via command, as there is a broken path definition. --- Dockerfile | 10 ++++------ compose.yaml | 9 +++++++++ 2 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 compose.yaml diff --git a/Dockerfile b/Dockerfile index 79d280a..9fabcba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Use the official Alpine Linux as the base image -FROM python:3.9-alpine +FROM python:3.11-alpine # Install Git RUN apk update && apk add --no-cache git @@ -10,11 +10,9 @@ WORKDIR /app # Copy the package files to the working directory COPY . . -# Install system dependencies -# RUN apk --no-cache add build-base libffi-dev - # Install Python dependencies -RUN pip install --no-cache-dir -r requirements.txt +RUN python -m pip install --upgrade pip +RUN pip install . # Set PYTHONPATH to the app directory ENV PYTHONPATH=/app @@ -23,4 +21,4 @@ ENV PYTHONPATH=/app EXPOSE 8000 # Command to run the FastAPI server -CMD ["python", "semantic_matcher/service.py"] \ No newline at end of file +CMD ["python", "semantic_matcher/service.py"] diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..ce3c9dd --- /dev/null +++ b/compose.yaml @@ -0,0 +1,9 @@ +services: + semantic_matching_service: + build: . + container_name: semantic_matching_service + restart: unless-stopped + ports: + - "8000:8000" + working_dir: /app/semantic_matcher + command: ["python", "service.py"]