mirror of
https://github.com/Hestia-Homes/survey-extraction.git
synced 2026-06-08 11:17:29 +00:00
30 lines
860 B
Docker
30 lines
860 B
Docker
# ---------- Builder Stage (uses Poetry) ----------
|
|
FROM python:3.12-slim as builder
|
|
|
|
# Install Poetry
|
|
RUN pip install --no-cache-dir poetry
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy only what's needed for dependency resolution
|
|
COPY pyproject.toml poetry.lock ./
|
|
|
|
# Export dependencies (no dev) to requirements.txt
|
|
RUN poetry export -f requirements.txt --without-hashes --only main -o requirements.txt
|
|
|
|
# Install into a clean target folder
|
|
RUN pip install --no-cache-dir -r requirements.txt --target /python
|
|
|
|
# ---------- Final Lambda Image ----------
|
|
FROM public.ecr.aws/lambda/python:3.12
|
|
|
|
# Copy installed dependencies from builder
|
|
COPY --from=builder /python /var/task
|
|
|
|
# Copy your app code
|
|
COPY etl/ /var/task/etl/
|
|
COPY deployment/lambda/extractor_and_loader/docker/app.py /var/task/
|
|
|
|
# Set the Lambda handler (file.function_name)
|
|
CMD ["app.handler"]
|