Skip to content

Conversation

@danielivanovz
Copy link

Summary

Adds support for Docker build options (buildArgs, secrets, target, network, ssh) when deploying Python functions as container images. These options are passed through to the @pulumi/docker-build Image component.

Motivation

When deploying Python Lambda functions as containers, users often need to:

  • Pass build-time arguments (e.g., version info, feature flags)
  • Use secrets for private package registries like AWS CodeArtifact
  • Target specific stages in multi-stage Dockerfiles
  • Configure network mode for build-time dependencies
  • Forward SSH keys for private Git repositories

Changes

  • Extended the python interface in FunctionArgs with new optional properties
  • Updated createImageAsset() to pass these options to the Docker Image component
  • Added example and documentation in examples/aws-python-container/

Example Usage

new sst.aws.Function("MyFunction", {
  python: {
    container: true,
    buildArgs: { GIT_COMMIT: "abc123" },
    secrets: { CODEARTIFACT_AUTH_TOKEN: process.env.CODEARTIFACT_AUTH_TOKEN },
    target: "production",
  },
  handler: "src/api.handler",
  runtime: "python3.11",
});

Add support for buildArgs, secrets, target, network, and ssh options
when deploying Python functions as container images.

These options are passed through to the @pulumi/docker-build Image
component, enabling:
- Build arguments for compile-time configuration
- Build secrets for sensitive values (e.g. CodeArtifact tokens)
- Multi-stage build targets
- Custom network modes for RUN instructions
- SSH forwarding for private Git repositories
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