Skip to content

Commit

Permalink
Merge pull request #1750 from ministryofjustice/MLPAB-2818-keep-aws-l…
Browse files Browse the repository at this point in the history
…ambda-rie-up-to-date

MLPAB-2818 - update lambda runtime interface emulator
  • Loading branch information
andrewpearce-digital authored Jan 31, 2025
2 parents e8d1b3a + a8617b7 commit 6c002b1
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 28 deletions.
Binary file removed docker/aws-lambda-rie/aws-lambda-rie
Binary file not shown.
14 changes: 0 additions & 14 deletions docker/event-received/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 1 addition & 14 deletions docker/schedule-runner/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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" \
Expand Down
Original file line number Diff line number Diff line change
@@ -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
```

0 comments on commit 6c002b1

Please sign in to comment.