Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 40 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,43 @@
# https://docs.docker.com/engine/reference/builder/
# BUILDER STAGE
FROM python:3.12-slim AS builder

FROM python:3.12
COPY dist/*.whl .
WORKDIR /build

# Install Poetry and export plugin
RUN pip install poetry==1.8.3

# 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
# Ejecuta la función main() del módulo controller.kafka_app

# 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"]
Loading
Loading