-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Description
Allow the ability to customize the environment Python builds are done within, whilst still taking advantage of the simplicity of what PythonFunction provides.
Specifically, without requiring us to provide a custom docker image, allow us to specify custom docker volumes, and custom shell commands to run before the build.
This is a similar but different requirement to Allow the use of CodeArtifact, and it may be that the same solution applies for both use cases.
Please note that I'm explicitly avoiding customisation of the Docker image build; this is customisation of how the python build is executed using a Docker image.
Use Case
I want my Lambda code to be able to have dependencies on packages in Github private repositories. To allow from this, I want to be able to copy my SSH keys from my host machine into the build Docker volume, so that the build can authenticate to Github using my SSH keys.
Proposed Solution
Allow for syntax something like:
aws_lambda_python.PythonFunction(
scope=self,
id="FunctionId",
handler="handler",
runtime=aws_lambda.Runtime.PYTHON_3_8,
entry="source-entry",
prebuild_command=[
"bash",
"-c",
"cp -r /tmp/ssh/* ~/.ssh/",
],
build_docker_volumes=[
core.DockerVolume(
container_path="/tmp/ssh",
host_path=f"{Path.home()}/.ssh",
),
],
)
This is a 🚀 Feature Request