This repository was archived by the owner on Jul 21, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
feat: duckdb extensions in lambda #75
Merged
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
4056102
--wip-- [skip ci]
gadomski 7196c61
feat: include duckdb extensions in lambda
gadomski 5e7e44a
fix: mangum extra
gadomski 975c6da
fix: got the build working for local deploys
gadomski 64b4372
feat: use wheel stacrs
gadomski cdb0e4b
fix: very duct tape
gadomski 2f67496
feat: install duckdb in ci
gadomski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,29 +1,32 @@ | ||
| ARG PYTHON_VERSION=3.12 | ||
| ARG BUILDPLATFORM=x86_64 | ||
|
|
||
| FROM public.ecr.aws/lambda/python:${PYTHON_VERSION} | ||
| COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ | ||
| FROM --platform=${BUILDPLATFORM} ghcr.io/astral-sh/uv:0.6.6 AS uv | ||
| FROM --platform=${BUILDPLATFORM} public.ecr.aws/lambda/python:${PYTHON_VERSION} AS builder | ||
|
|
||
| ENV UV_COMPILE_BYTECODE=1 | ||
| ENV UV_NO_INSTALLER_METADATA=1 | ||
| ENV UV_LINK_MODE=copy | ||
|
|
||
| # Install required utilities | ||
| RUN dnf install -y findutils binutils git && \ | ||
| dnf clean all && \ | ||
| rm -rf /var/cache/dnf | ||
|
|
||
| WORKDIR /tmp | ||
| COPY uv.lock uv.lock | ||
| COPY pyproject.toml pyproject.toml | ||
| COPY README.md README.md | ||
| COPY src/ src/ | ||
|
|
||
| RUN uv pip install --compile-bytecode .[lambda] --target /asset | ||
|
|
||
| # Reduce package size and remove useless files | ||
| RUN --mount=from=uv,source=/uv,target=/bin/uv \ | ||
| --mount=type=cache,target=/root/.cache/uv \ | ||
| --mount=type=bind,source=uv.lock,target=uv.lock \ | ||
| --mount=type=bind,source=pyproject.toml,target=pyproject.toml \ | ||
| uv export --frozen --no-emit-workspace --no-dev --no-editable --extra lambda -o requirements.txt && \ | ||
| uv pip install -r requirements.txt --target /asset | ||
| WORKDIR /asset | ||
| RUN python -c "from stacrs import DuckdbClient; DuckdbClient(use_s3_credential_chain=True, use_azure_credential_chain=False, install_extensions=True, extension_directory='/asset')" | ||
| RUN find . -type f -name '*.pyc' | while read f; do n=$(echo $f | sed 's/__pycache__\///' | sed 's/.cpython-[0-9]*//'); cp $f $n; done; | ||
| RUN find . -type d -a -name '__pycache__' -print0 | xargs -0 rm -rf | ||
| RUN find . -type f -a -name '*.py' -print0 | xargs -0 rm -f | ||
| RUN find . -type d -a -name 'tests' -print0 | xargs -0 rm -rf | ||
|
|
||
| # Strip debug symbols from compiled C/C++ code | ||
| RUN find . -type f -name '*.so*' -exec strip --strip-unneeded {} \; | ||
|
|
||
| FROM --platform=${BUILDPLATFORM} public.ecr.aws/lambda/python:${PYTHON_VERSION} | ||
| WORKDIR /asset | ||
| COPY --from=builder /asset /asset | ||
| COPY infrastructure/aws/lambda/handler.py /asset/handler.py |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.