n-daisuke-blog-deployment-s.../docker/Dockerfile
Daisuke 8cd30da394 fix: resolve Lambda invocation failure from API Gateway
- Align Dockerfile with AWS official documentation for provided runtime
- Remove DefinitionBody from SAM template to avoid conflict with Events property
- This enables SAM to automatically generate AWS::Lambda::Permission resource
- Fixes 500 error when Forgejo webhook triggers API Gateway endpoint"
2026-01-12 21:25:06 +09:00

17 lines
No EOL
645 B
Docker

FROM docker.io/golang:1.25.5-bookworm as build
WORKDIR /app
# NOTE: This Dockerfile assumes the build context is the repository root.
# Example: docker build -f docker/Dockerfile .
COPY go.mod go.sum ./
RUN go mod download
COPY . .
# Build with optional lambda.norpc tag for arm64 architecture
RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -tags lambda.norpc -o main ./cmd/lambda
# 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 ./main
ENTRYPOINT [ "./main" ]