Skip to content

Add adapter in Dockerfile and lunch it locally (or CI) for integration test #449

@dicrescenzoa

Description

@dicrescenzoa

Hello everyone,

We need to run the adapter locally (or in CI) in order to run integration test.

Specifically the flow that we want to cover is apigateway invocation event -> web-adapter -> code

Specifically we want to test how the lambda receive the invocation message and how this is going to be handled by the adapter and the http framework below.

for example with a request like this

We are trying to test with the go-gin example

FROM golang:1.18-alpine AS build_base
RUN apk add --no-cache git
WORKDIR /tmp/gin

COPY . .
RUN go mod download

RUN GOOS=linux CGO_ENABLED=0 go build -o bootstrap .
FROM alpine:3.9 
RUN apk add ca-certificates
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.8.1 /lambda-adapter /opt/extensions/lambda-adapter
COPY --from=build_base /tmp/gin/bootstrap /app/bootstrap

ENV PORT=8000 GIN_MODE=release
EXPOSE 8000

CMD ["/app/bootstrap"]

We are building the image as following and running with these commands

docker build -t gin-web-adapter-test:latest . 

docker run -p 127.0.0.1:8080:8000 gin-web-adapter-test:latest

However we see that in this way we run directly the code and not the layer that should be used for converting the invocation to the http request.

Thank you for you support 👍

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions