diff --git a/docker/aws-lambda-rie/aws-lambda-rie b/docker/aws-lambda-rie/aws-lambda-rie deleted file mode 100644 index 059285d7c2..0000000000 Binary files a/docker/aws-lambda-rie/aws-lambda-rie and /dev/null differ diff --git a/docker/event-received/Dockerfile b/docker/event-received/Dockerfile index c08966cf87..23ae7e2e8c 100644 --- a/docker/event-received/Dockerfile +++ b/docker/event-received/Dockerfile @@ -10,20 +10,6 @@ COPY --link internal ./internal RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} CGO_ENABLED=0 go build -o event-received ./cmd/event-received -FROM public.ecr.aws/lambda/provided:al2023.2024.10.14.12 AS dev - -WORKDIR /app - -COPY --from=build /app/event-received /var/task/event-received -COPY --link lang /var/task/lang -COPY --link ./docker/adot-collector/ /opt -COPY --link docker/aws-lambda-rie ./aws-lambda-rie - -ENV AWS_LAMBDA_EXEC_WRAPPER=/opt/otel-handler -ENV OPENTELEMETRY_COLLECTOR_CONFIG_URI="/opt/config/config.yaml" - -ENTRYPOINT ["./event-received"] - FROM public.ecr.aws/lambda/provided:al2023.2024.10.14.12 AS production WORKDIR /app diff --git a/docker/schedule-runner/Dockerfile b/docker/schedule-runner/Dockerfile index 1fd8594fa3..26bfd7d6a9 100644 --- a/docker/schedule-runner/Dockerfile +++ b/docker/schedule-runner/Dockerfile @@ -10,23 +10,10 @@ COPY --link internal ./internal RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} CGO_ENABLED=0 go build -ldflags="-X main.Tag=${TAG}" -o schedule-runner ./cmd/schedule-runner -FROM public.ecr.aws/lambda/provided:al2023.2024.10.14.12 AS dev - -WORKDIR /app - -COPY --from=build /app/schedule-runner /var/task/schedule-runner -COPY --link lang ./lang -COPY --link ./docker/adot-collector/ /opt -COPY --link docker/aws-lambda-rie ./aws-lambda-rie - -ENV AWS_LAMBDA_EXEC_WRAPPER=/opt/otel-handler -ENV OPENTELEMETRY_COLLECTOR_CONFIG_URI="/opt/config/config.yaml" - -ENTRYPOINT ["./schedule-runner"] - FROM public.ecr.aws/lambda/provided:al2023.2024.10.14.12 AS production WORKDIR /app + COPY --link docker/install_lambda_insights.sh /app/ RUN chmod +x "/app/install_lambda_insights.sh" \ diff --git a/docs/runbooks/update_lambda_runtime_interface_emulator_for_local_dev.md b/docs/runbooks/update_lambda_runtime_interface_emulator_for_local_dev.md new file mode 100644 index 0000000000..771f06f4a0 --- /dev/null +++ b/docs/runbooks/update_lambda_runtime_interface_emulator_for_local_dev.md @@ -0,0 +1,33 @@ +# Using the Lambda Runtime Interface Emulator + +## Introduction + +The Lambda Runtime Interface Emulator (RIE) can be used to locally test a lambda image. + +These instructions are from [Deploy Go Lambda functions with container images](https://docs.aws.amazon.com/lambda/latest/dg/go-image.html) + +The RIE can be downloaded to you home directory with the following command. + +```shell +mkdir -p ~/.aws-lambda-rie && \ + curl -Lo ~/.aws-lambda-rie/aws-lambda-rie https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie && \ + chmod +x ~/.aws-lambda-rie/aws-lambda-rie +``` + +The arm64 emulator is at `https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie-arm64` + +## Using the Lambda RIE in a docker container + +You can run the container with the RIE by mounting in the volume. + +Note the following + +- docker-image is the image name and test is the tag. +- /main is the ENTRYPOINT from your Dockerfile. + +```shell +docker run --platform linux/amd64 -d -v ~/.aws-lambda-rie:/aws-lambda -p 9000:8080 \ + --entrypoint /aws-lambda/aws-lambda-rie \ + docker-image:test \ + /main +```