Skip to content

Feat/docker lambda build#37

Merged
armaan-71 merged 2 commits intomainfrom
feat/docker-lambda-build
Feb 26, 2026
Merged

Feat/docker lambda build#37
armaan-71 merged 2 commits intomainfrom
feat/docker-lambda-build

Conversation

@armaan-71
Copy link
Copy Markdown
Owner

No description provided.

- Removed local bundling fallback in CDK stack to enforce Linux builds
- Appended --platform manylinux2014_x86_64 to pip install to guarantee AWS compatibility for lxml C-extensions
- Updated README.md to list Docker Desktop as a prerequisite
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the deployment process for Python AWS Lambda functions by integrating Docker-based bundling. This change addresses potential inconsistencies in dependency resolution, particularly for Python packages with C-extensions, by ensuring that all dependencies are built in an environment that mirrors the AWS Lambda runtime. The README.md has also been updated to reflect this new prerequisite.

Highlights

  • Docker-based Lambda Bundling: Switched the Python AWS Lambda function bundling process to use Docker, ensuring consistent dependency resolution, especially for C-extensions, by building within a manylinux2014_x86_64 compatible environment.
  • Documentation Update: Updated the README.md to include Docker as a new prerequisite for local development and deployment, explaining its necessity for cross-compiling Python C-extensions.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • README.md
    • Added Docker as a required prerequisite for local development and deployment.
  • infra/lib/outpost-stack.ts
    • Modified the processRunFunction's bundling strategy to use a Docker image for installing Python dependencies and copying handler code.
    • Replaced the local bundling configuration with a command that executes pip install within the Docker container, targeting manylinux2014_x86_64 for binary compatibility.
    • Adjusted the code asset path to point to the root of the Python backend directory instead of just the handlers directory.
Activity
  • No human activity recorded for this pull request.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the Python Lambda function's deployment package creation to use Docker for bundling. This is a significant improvement, as it ensures that dependencies with C-extensions are compiled for the correct Lambda execution environment, resolving potential cross-platform issues. The README has also been updated to include Docker as a prerequisite. My review includes a suggestion to align the Lambda function's architecture with other functions in the stack for consistency and potential performance improvements.

Comment on lines 122 to 133
runtime: lambda.Runtime.PYTHON_3_12,
handler: 'process_run.handler',
code: lambda.Code.fromAsset(path.join(__dirname, '../../backend/python/src/handlers'), {
code: lambda.Code.fromAsset(path.join(__dirname, '../../backend/python'), {
bundling: {
image: lambda.Runtime.PYTHON_3_12.bundlingImage,
local: {
tryBundle(outputDir: string) {
try {
// Install dependencies into the output directory
execSync(
`pip3 install -r ${path.join(__dirname, '../../backend/python/requirements.txt')} -t ${outputDir}`,
);
// Copy the handler code into the output directory
execSync(
`cp -R ${path.join(__dirname, '../../backend/python/src/handlers/process_run.py')} ${outputDir}`,
);
return true;
} catch (e) {
console.warn('Local Python bundling failed:', e);
return false;
}
},
},
command: [
'bash',
'-c',
'pip install -r requirements.txt -t /asset-output --platform manylinux2014_x86_64 --only-binary=:all: && cp -R src/handlers/* /asset-output/',
],
},
}),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency with the Go Lambda functions in this stack which use ARM64, consider specifying the architecture for this Python function as well. ARM-based Lambdas can also provide better price/performance.

If you switch to ARM64, you'll need to update the bundling command to install the correct platform-specific wheels for your dependencies.

      runtime: lambda.Runtime.PYTHON_3_12,
      architecture: lambda.Architecture.ARM_64,
      handler: 'process_run.handler',
      code: lambda.Code.fromAsset(path.join(__dirname, '../../backend/python'), {
        bundling: {
          image: lambda.Runtime.PYTHON_3_12.bundlingImage,
          command: [
            'bash',
            '-c',
            'pip install -r requirements.txt -t /asset-output --platform manylinux2014_aarch64 --only-binary=:all: && cp -R src/handlers/* /asset-output/',
          ],
        },
      }),

- Set python lambda architecture to ARM_64 for better price/performance
- Updated pip build platform target to manylinux2014_aarch64
@armaan-71 armaan-71 merged commit f9c93df into main Feb 26, 2026
1 check passed
@armaan-71 armaan-71 deleted the feat/docker-lambda-build branch February 26, 2026 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant