From da226ebee83ead1152f799a62c3e9dab7d81cccb Mon Sep 17 00:00:00 2001 From: Maximilian Jugl Date: Tue, 13 Feb 2024 14:05:11 +0100 Subject: [PATCH] feat: add Dockerfile --- Dockerfile | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2dbafdc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM python:3.11-alpine AS builder + +WORKDIR /tmp +COPY ./pyproject.toml ./poetry.lock ./ + +RUN pip install poetry==1.7.1 && \ + poetry export -n --without dev -f requirements.txt -o requirements.txt + +FROM python:3.11-alpine + +WORKDIR /app + +COPY ./config/ ./config/ +COPY --from=builder /tmp/requirements.txt ./ +COPY ./project/ ./project/ + +RUN pip install -r requirements.txt + +# PYTHONPATH hack is needed here because /app contains the "project" +# module which is referenced in parts of the source code. +ENV PYTHONPATH=/app + +CMD ["python", "project/main.py", "server", "--no-reload", "-p", "8080"]