38366dadeb
Lambda Function using Docker * baseImage * testfindlamdafunctions * fixstep * yamlsyntax * servicestructure * nameplacement * testdockerbuild * definecaches * onelinebash * uniquecaches * listsyntax * cachebasedir * resetcaches * cachebycommit * artifacts * dockerfileforall * removePipe Approved-by: Umang Mistry
27 lines
870 B
Docker
27 lines
870 B
Docker
# syntax=docker/dockerfile:1
|
|
|
|
ARG PYTHON_VERSION=3.12
|
|
# options: 3.12, 3.9, 3.8
|
|
FROM public.ecr.aws/lambda/python:${PYTHON_VERSION}
|
|
|
|
# Prevents Python from writing pyc files.
|
|
ENV PYTHONDONTWRITEBYTECODE=1
|
|
|
|
# Keeps Python from buffering stdout and stderr to avoid situations where
|
|
# the application crashes without emitting any logs due to buffering.
|
|
ENV PYTHONUNBUFFERED=1
|
|
|
|
WORKDIR /app
|
|
|
|
# Download dependencies as a separate step to take advantage of Docker's caching.
|
|
# Leverage a cache mount to /root/.cache/pip to speed up subsequent builds.
|
|
# Leverage a bind mount to requirements.txt to avoid having to copy them into
|
|
# into this layer.
|
|
RUN --mount=type=cache,target=/root/.cache/pip \
|
|
--mount=type=bind,source=requirements.txt,target=requirements.txt \
|
|
python -m pip install -r requirements.txt
|
|
|
|
COPY . ${LAMBDA_TASK_ROOT}
|
|
|
|
CMD [ "index.lambda_handler" ]
|