- Move application entrypoint to cmd/lambda/ - Move Dockerfile to docker/ for clearer build context separation - Promote go.mod/go.sum to project root - Move CloudFormation templates under infra/cfn/ for consistent infra layout - Add new template-container-repository.yaml defining ECR repository (blog-deployment) - Move Lambda test files to test/ directory
17 lines
No EOL
537 B
Docker
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" ] |