From 38366dadebb787022f99b82e63a6d47edc6ed4a5 Mon Sep 17 00:00:00 2001 From: Michael McGuinness Date: Fri, 11 Oct 2024 14:14:15 +0000 Subject: [PATCH] Merged in feature/dockerImages (pull request #189) 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 --- release/.dockerignore | 34 ++++++++++++++++++++++++++++++++++ release/Dockerfile | 26 ++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 release/.dockerignore create mode 100644 release/Dockerfile diff --git a/release/.dockerignore b/release/.dockerignore new file mode 100644 index 0000000..03a268b --- /dev/null +++ b/release/.dockerignore @@ -0,0 +1,34 @@ +# Include any files or directories that you don't want to be copied to your +# container here (e.g., local build artifacts, temporary files, etc.). +# +# For more help, visit the .dockerignore file reference guide at +# https://docs.docker.com/go/build-context-dockerignore/ + +**/.DS_Store +**/__pycache__ +**/.venv +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/bin +**/charts +**/docker-compose* +**/compose.y*ml +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +LICENSE +README.md diff --git a/release/Dockerfile b/release/Dockerfile new file mode 100644 index 0000000..3a1d6f9 --- /dev/null +++ b/release/Dockerfile @@ -0,0 +1,26 @@ +# 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" ]