Skip to content

Publish extension as a docker image #195

@AlexanderWert

Description

@AlexanderWert

Currently, we only support Elastic APM with Lambda function that are deployed as ZIP archives.
In order to support scenarios where users deploy their function as a docker container, we need to provide an easy way to integrate the lambda extension into their target Dockerfile.

For this we need to publish the lambda extension as a Docker image, using a simple Dockerfile like:

FROM scratch
ARG EXTENSION_BINARY
COPY ${EXTENSION_BINARY} /opt/extensions

The users can then use this image to easily include the extension in their Docker image for their function:

FROM docker.elastic.co/observability/lambda-extension-layer AS lambda-extension
FROM docker.elastic.co/observability/java-apm-layer AS java-agent

FROM public.ecr.aws/lambda/java:11

# Extension Layer code
COPY --from=lambda-extension /opt /opt               <-- COPY LAMBDA EXTENSION
COPY --from=java-agent /opt /opt                           <-- COPY JAVA AGENT

# Copy function code and runtime dependencies from Gradle layout
COPY build/classes/java/main ${LAMBDA_TASK_ROOT}
COPY build/dependency/* ${LAMBDA_TASK_ROOT}/lib/



# Set the CMD to your handler (could also be done as a parameter override outside of the Dockerfile)
CMD [ "co.elastic.test.lambda.ApiGatewayV1Handler" ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions