survey-extraction/deployment/lambda/extractor_and_loader/docker/Dockerfile
2025-07-18 16:11:58 +00:00

30 lines
901 B
Docker

# Start from lightweight base image
FROM python:3.12-slim
# Set environment vars to reduce image size and avoid bytecode
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1
# Install required system packages and Lambda RIC
RUN apt-get update && apt-get install -y curl \
&& pip install awslambdaric \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /var/task
# Copy Poetry files and export dependencies
COPY pyproject.toml poetry.lock ./
RUN pip install poetry \
&& poetry export -f requirements.txt --without-hashes --only main -o requirements.txt \
&& pip install -r requirements.txt --target . \
&& rm -rf ~/.cache .venv
# Copy app code
COPY etl/ etl/
COPY deployment/lambda/extractor_and_loader/docker/app.py .
# Lambda entrypoint
ENTRYPOINT ["/usr/local/bin/python3", "-m", "awslambdaric"]
CMD ["app.handler"]