Dockerize serverless in go: no such file or directory

I’m currently stuck at /fork/exec /var/task/main no such file or directory when running serverless function written in go in Docker.
I want to dockerize the serverless function so that it’s not necessary to install go or node on machine.
I use multi stage build inside docker. first stage is to compile into go binary, and second stage uses node image to execute serverless. Below is sample

FROM golang as builder
COPY go.mod go.sum ./
RUN go mod download
COPY main.go .
RUN GOOS=linux go build -ldflags '-s -w' -a -installsuffix cgo -o /bin/main main.go
RUN GOOS=linux go build -ldflags '-s -w' -buildmode=plugin -a -installsuffix cgo -o /opt/ plugins/pi.go

FROM node:12-alpine
RUN apk add --no-cache bash
RUN apk add --update alpine-sdk
# install docker
RUN apk add docker
RUN apk update
RUN apk add openrc --no-cache
RUN rc-update add docker boot
RUN npm install -g serverless

RUN npm install --save-dev serverless-offline

COPY --from=builder /bin/main ./main
COPY --from=builder /opt/pi ./pi
COPY serverless.yml ./

RUN serverless slstats --disable
CMD [ "sls", "offline", "start"]

When running image, docker run -v /var/run/docker.sock:/var/run/docker.sock -p 3000:3000 --name sample sample. to mount docker lock so that the sample container can bring up sls-docker

This successfully creates .serverless in app directory and everything within .serverless just like when i run locally, it builds docker image and run sls-docker, but output was

  "errorMessage": "fork/exec /var/task/bin/main: no such file or directory",
  "errorType": "PathError"

I tried to remove the WORKDIR /app from second stage and put everything in root directory. if i do that, excluding development dependencies take forever and can’t bring docker image up.
Also I tried individually, and it takes too long
Below is serverless.yml

    path: ./opt/
        - ./opt/
      - go1.x
    description: plugins
    handler: bin/main
       - ./**
       - ./bin/main
       - {Ref: PiLayer}
    name: main_lambda
    description: >-
      lambda func.
    memorySize: 256
    tracing: PassThrough
      - http:
          path: public-api-seed
          method: POST
          enabled: true

anyone have ideas to resolve this, why i can’t execute in docker?
I want to inspect the contents of the docker container created by serverless, but it destroys the container every time when it’d done their job

This may not be appropriate for this forum, but this is how I solved the problem.
Instead of using serverless, execute codes directly in lambci/lambda since it is actually the image that serverless use to execute code on

I used docker to compile go files into its appropriate environment.

# base image
FROM golang:1.13

COPY go.mod go.sum ./

RUN go mod download

#build executable and plugins
COPY . .
RUN GOOS=linux go build -ldflags '-s -w' -a -installsuffix cgo -o ./bin/main main.go
RUN GOOS=linux go build -ldflags '-s -w' -buildmode=plugin -a -installsuffix cgo -o ./opt/ plugins/pi.go

In Makefile, build and run the image, copy the binary files to local, and finally attach those files as volume to lamci/lambda image and run.

	docker build -t go-serverless .
	docker run -d --name go-serverless go-serverless
	docker cp go-serverless:/app/bin/ $(PWD)/bin
	docker cp go-serverless:/app/opt/ $(PWD)/opt
	docker stop go-serverless
	docker rm go-serverless

dockerInvoke: dockerBuild
	 cat event.json | docker run --rm -v $(PWD):/var/task -v $(PWD)/opt:/opt -i -e DOCKER_LAMBDA_USE_STDIN=1 --env-file env.list lambci/lambda:go1.x bin/main

By doing so, I am certain that I am attaching the executable files to its appropriate place, and being able to run the lambda function

I hope this is helpful for someone else, and let me know if you encounter problems.