-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to using uv's built-in project and dependency management; upda…
…te Dockerfile to use uv; use arm64 Docker image
- Loading branch information
Showing
9 changed files
with
624 additions
and
584 deletions.
There are no files selected for viewing
39 changes: 26 additions & 13 deletions
39
...aform/services/pipeline/modules/bfd_pipeline_ccw_manifests_verifier/lambda_src/Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,28 @@ | ||
FROM public.ecr.aws/lambda/python:3.13 as base | ||
FROM ghcr.io/astral-sh/uv:0.5.22 AS uv | ||
# First, bundle the dependencies into the task root. | ||
FROM public.ecr.aws/lambda/python:3.13-arm64 AS builder | ||
# Enable bytecode compilation, to improve cold-start performance. | ||
ENV UV_COMPILE_BYTECODE=1 | ||
# Disable installer metadata, to create a deterministic layer. | ||
ENV UV_NO_INSTALLER_METADATA=1 | ||
# Enable copy mode to support bind mount caching. | ||
ENV UV_LINK_MODE=copy | ||
# Bundle the dependencies into the Lambda task root via `uv pip install --target`. | ||
# | ||
# Omit any local packages (`--no-emit-workspace`) and development dependencies (`--no-dev`). | ||
# This ensures that the Docker layer cache is only invalidated when the `pyproject.toml` or `uv.lock` | ||
# files change, but remains robust to changes in the application code. | ||
COPY pyproject.toml . | ||
COPY uv.lock . | ||
RUN --mount=from=uv,source=/uv,target=/bin/uv \ | ||
--mount=type=cache,target=/root/.cache/uv \ | ||
uv export --frozen --no-emit-workspace --no-dev --no-editable -o requirements.txt && \ | ||
uv pip install -r requirements.txt --target "${LAMBDA_TASK_ROOT}" | ||
|
||
# Build required python packages | ||
FROM base as python | ||
COPY requirements.txt . | ||
RUN pip3 install -r requirements.txt | ||
|
||
# Copy function code | ||
FROM base as lambda | ||
COPY --from=python /var/lang/lib/python3.13/site-packages /var/lang/lib/python3.13/site-packages | ||
COPY --from=python /var/lang/bin /var/lang/bin | ||
COPY . "${LAMBDA_TASK_ROOT}/" | ||
ENV PATH="/var/lang/lib/python3.13/site-packages:${PATH}" | ||
CMD [ "ccw_manifests_verifier.handler" ] | ||
FROM public.ecr.aws/lambda/python:3.13-arm64 | ||
# Copy the runtime dependencies from the builder stage. | ||
COPY --from=builder ${LAMBDA_TASK_ROOT} ${LAMBDA_TASK_ROOT} | ||
# Copy the application code. | ||
COPY . ${LAMBDA_TASK_ROOT}/app | ||
CMD [ "app.ccw_manifests_verifier.handler" ] | ||
|
3 changes: 2 additions & 1 deletion
3
...s/pipeline/modules/bfd_pipeline_ccw_manifests_verifier/lambda_src/Dockerfile.dockerignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
* | ||
!requirements.txt | ||
!pyproject.toml | ||
!uv.lock | ||
!ccw_manifests_verifier.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
...vices/pipeline/modules/bfd_pipeline_ccw_manifests_verifier/lambda_src/dev-requirements.in
This file was deleted.
Oops, something went wrong.
69 changes: 0 additions & 69 deletions
69
...ices/pipeline/modules/bfd_pipeline_ccw_manifests_verifier/lambda_src/dev-requirements.txt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletions
5
.../services/pipeline/modules/bfd_pipeline_ccw_manifests_verifier/lambda_src/requirements.in
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.