-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
43 lines (30 loc) · 1.05 KB
/
Dockerfile
File metadata and controls
43 lines (30 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# BUILDER STAGE
FROM python:3.12-slim AS builder
WORKDIR /build
# Install Poetry and export plugin
RUN pip install poetry==2.0.1 poetry-plugin-export
# Copy dependency files
COPY pyproject.toml poetry.lock README.md ./
# Export requirements.txt from poetry.lock for robust pip installation
# We use --without-hashes to avoid issues with some platforms/versions
RUN poetry export -f requirements.txt --output requirements.txt --without-hashes
# Copy source code
COPY src/ ./src/
# Build the wheel
RUN poetry build --format=wheel
# RUNNER STAGE
FROM python:3.12-slim
WORKDIR /app
# Copy requirements and wheel from builder
COPY --from=builder /build/requirements.txt .
COPY --from=builder /build/dist/*.whl .
# Install dependencies from the EXACT versions solved by Poetry
RUN pip install -r requirements.txt
# Install the application wheel
RUN pip install *.whl
# Copy configurations
COPY confs/ ./confs/
# Set environment variables
ENV PYTHONUNBUFFERED=1
# Entrypoint for the Kafka application
CMD ["python", "-m", "regression_model_template.controller.kafka_app"]