n-daisuke-blog-deployment-s.../docker/Dockerfile
Daisuke 2ebcc5541e refactor: improve Lambda handler and update Go to 1.25.5
- Update Dockerfile: Go 1.25.5, fix build context paths
- Use git archive instead of zip to exclude .git directory
- Add context support for git/zip operations (timeout control)
- Optimize git clone (--depth 1, --single-branch)
- Improve error handling (%w wrapping) and logging consistency
- Add case-insensitive HTTP header lookup for webhooks
2026-01-04 10:02:12 +09:00

18 lines
No EOL
625 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
RUN 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 ${LAMBDA_TASK_ROOT}
WORKDIR ${LAMBDA_TASK_ROOT}
ENTRYPOINT [ "./main" ]