mirror of
https://github.com/Hestia-Homes/survey-extraction.git
synced 2026-06-08 11:17:29 +00:00
more cleaner
This commit is contained in:
parent
4a06e52f41
commit
39a1eb29d5
1 changed files with 13 additions and 8 deletions
|
|
@ -9,15 +9,20 @@ RUN pip install poetry
|
|||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy only what's needed to resolve dependencies
|
||||
# Copy Poetry files and your source code
|
||||
COPY pyproject.toml poetry.lock ./
|
||||
COPY etl/ etl/
|
||||
|
||||
# Export main dependencies only
|
||||
# Export main dependencies
|
||||
RUN poetry export -f requirements.txt --without-hashes --only main -o requirements.txt
|
||||
|
||||
# Install dependencies to /python (Lambda expects this path)
|
||||
# Install into /python (Lambda expects this structure)
|
||||
RUN pip install --no-deps -r requirements.txt --target /python
|
||||
|
||||
# Optionally: strip cache, pyc, and tests to reduce size
|
||||
RUN find /python -type d -name "tests" -exec rm -rf {} + \
|
||||
&& find /python -type f -name "*.pyc" -delete
|
||||
|
||||
|
||||
# ----------- Runtime Stage (Slim and Clean) -----------
|
||||
FROM python:3.12-slim
|
||||
|
|
@ -26,19 +31,19 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
|
|||
PYTHONUNBUFFERED=1 \
|
||||
PIP_NO_CACHE_DIR=1
|
||||
|
||||
# Install Lambda Runtime Interface Client (RIC)
|
||||
# Install Lambda RIC
|
||||
RUN pip install awslambdaric
|
||||
|
||||
# Copy app dependencies from builder
|
||||
# Copy installed dependencies and app code from builder
|
||||
COPY --from=builder /python /var/task
|
||||
COPY --from=builder /app/etl /var/task/etl
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /var/task
|
||||
|
||||
# Copy application code
|
||||
COPY etl/ etl/
|
||||
# Copy Lambda handler
|
||||
COPY deployment/lambda/extractor_and_loader/docker/app.py .
|
||||
|
||||
# Lambda entrypoint
|
||||
# Set Lambda entrypoint and handler
|
||||
ENTRYPOINT ["python3", "-m", "awslambdaric"]
|
||||
CMD ["app.handler"]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue