mirror of
https://github.com/Hestia-Homes/survey-extraction.git
synced 2026-06-08 11:17:29 +00:00
working version
This commit is contained in:
parent
72b5b60b20
commit
8dfee813c4
1 changed files with 18 additions and 34 deletions
|
|
@ -1,41 +1,25 @@
|
|||
# ---------- Stage 1: Build (Poetry) ----------
|
||||
FROM public.ecr.aws/lambda/python:3.12 as builder
|
||||
FROM public.ecr.aws/lambda/python:3.12
|
||||
|
||||
ENV PATH="/root/.local/bin:$PATH" \
|
||||
PIP_NO_CACHE_DIR=1 \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
PYTHONDONTWRITEBYTECODE=1
|
||||
|
||||
# Install Poetry
|
||||
# Install Poetry (you could pin a version if you like)
|
||||
RUN curl -sSL https://install.python-poetry.org | python3 -
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy poetry config and install deps
|
||||
COPY pyproject.toml poetry.lock ./
|
||||
RUN poetry config virtualenvs.create false \
|
||||
&& poetry install --only main --no-interaction --no-ansi \
|
||||
&& rm -rf ~/.cache
|
||||
|
||||
# Copy source code
|
||||
COPY etl/ etl/
|
||||
COPY deployment/lambda/extractor_and_loader/docker/app.py .
|
||||
|
||||
# ---------- Stage 2: Runtime (Slim + RIC) ----------
|
||||
FROM python:3.12-slim
|
||||
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
PIP_NO_CACHE_DIR=1
|
||||
|
||||
# Install AWS Lambda Runtime Interface Client
|
||||
RUN pip install awslambdaric
|
||||
# Add Poetry to PATH
|
||||
ENV PATH="/root/.local/bin:$PATH"
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /var/task
|
||||
|
||||
# Copy minimal runtime files from builder
|
||||
COPY --from=builder /app /var/task
|
||||
# Copy Poetry files first to leverage Docker layer caching
|
||||
COPY pyproject.toml poetry.lock README.md ./
|
||||
COPY etl/ etl/
|
||||
|
||||
# Lambda entrypoint
|
||||
ENTRYPOINT ["python3", "-m", "awslambdaric"]
|
||||
CMD ["app.handler"]
|
||||
|
||||
# Install dependencies into /var/task
|
||||
RUN poetry config virtualenvs.create false \
|
||||
&& poetry install --only main --no-interaction --no-ansi
|
||||
|
||||
# Copy app code
|
||||
COPY deployment/lambda/extractor_and_loader/docker/app.py ./
|
||||
|
||||
# Set Lambda handler
|
||||
CMD ["app.handler"]
|
||||
Loading…
Add table
Reference in a new issue