You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We recently allowed for customizable deployment runtimes for all the services. However, there is a big caveat in how we implemented this : the docker images associated with the default runtimes are built even if the user passes custom runtimes. In an of itself this is undesirable, but even more so because the way the CDK handles docker builds under the hood is kind of messy -- the less often it happens the better.
This ticket flags that we should make sure not to build our default images if custom runtimes are provided.
The text was updated successfully, but these errors were encountered:
Taking the stac api example, the fix should be as easy as
// Check if 'code' is provided in lambdaFunctionOptions
const isCodeProvided = props.lambdaFunctionOptions && 'code' in props.lambdaFunctionOptions;
// Initialize a variable for the code configuration
let lambdaCodeConfig;
// If 'code' is not provided in props.lambdaFunctionOptions, then define the default code configuration
// If 'code' is indeed provided in props.lambdaFunctionOptions, we'll skip building the images of the default runtimes.
if (!isCodeProvided) {
lambdaCodeConfig = lambda.Code.fromDockerBuild(__dirname, {
file: "runtime/Dockerfile",
buildArgs: { PYTHON_VERSION: '3.11' },
});
}
this.stacApiLambdaFunction = new lambda.Function(this, "lambda", {
// defaults for configurable properties
runtime: lambda.Runtime.PYTHON_3_11,
handler: "src.handler.handler",
memorySize: 8192,
logRetention: aws_logs.RetentionDays.ONE_WEEK,
timeout: Duration.seconds(30),
// Use the defined code configuration if 'code' is not provided in props
code: isCodeProvided ? undefined : lambdaCodeConfig,
// overwrites defaults with user-provided configurable properties
...props.lambdaFunctionOptions,
// Non configurable properties that are going to be overwritten even if provided by the user
vpc: props.vpc,
vpcSubnets: props.subnetSelection,
allowPublicSubnet: true,
environment: {
PGSTAC_SECRET_ARN: props.dbSecret.secretArn,
DB_MIN_CONN_SIZE: "0",
DB_MAX_CONN_SIZE: "1",
...props.apiEnv,
},
});
We recently allowed for customizable deployment runtimes for all the services. However, there is a big caveat in how we implemented this : the docker images associated with the default runtimes are built even if the user passes custom runtimes. In an of itself this is undesirable, but even more so because the way the CDK handles docker builds under the hood is kind of messy -- the less often it happens the better.
This ticket flags that we should make sure not to build our default images if custom runtimes are provided.
The text was updated successfully, but these errors were encountered: