mirror of
https://github.com/Hestia-Homes/survey-extraction.git
synced 2026-06-08 11:17:29 +00:00
don't use aws lambda
This commit is contained in:
parent
dcf589f175
commit
f84a50a9e2
1 changed files with 22 additions and 22 deletions
|
|
@ -1,30 +1,30 @@
|
|||
# ---------- Builder Stage (uses Poetry) ----------
|
||||
FROM python:3.12-slim as builder
|
||||
# Start from lightweight base image
|
||||
FROM python:3.12-slim
|
||||
|
||||
# Install Poetry
|
||||
RUN pip install --no-cache-dir poetry
|
||||
# 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 /app
|
||||
WORKDIR /var/task
|
||||
|
||||
# Copy only what's needed for dependency resolution
|
||||
# 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
|
||||
|
||||
# Export dependencies (no dev) to requirements.txt
|
||||
RUN poetry export -f requirements.txt --without-hashes --only main -o requirements.txt
|
||||
# Copy app code
|
||||
COPY etl/ etl/
|
||||
COPY deployment/lambda/extractor_and_loader/docker/app.py .
|
||||
|
||||
# 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)
|
||||
# Lambda entrypoint
|
||||
ENTRYPOINT ["/usr/local/bin/python3", "-m", "awslambdaric"]
|
||||
CMD ["app.handler"]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue