n-daisuke-blog-deployment-s.../Dockerfile

17 lines
No EOL
537 B
Docker

FROM docker.io/golang:1.24.2-bookworm as build
WORKDIR /app
# Copy dependencies list
COPY ./app/go.mod ./
COPY ./app/go.sum ./
# Build with optional lambda.norpc tag
COPY ./app/main.go ./
RUN go build -tags lambda.norpc -o main main.go
# Copy artifacts to a clean image
FROM public.ecr.aws/lambda/provided:al2023
# Install git and zip using dnf (Amazon Linux 2023)
RUN dnf update -y && \
dnf install -y git zip && \
dnf clean all
COPY --from=build /app/main ${LAMBDA_TASK_ROOT}
WORKDIR ${LAMBDA_TASK_ROOT}
ENTRYPOINT [ "./main" ]