-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.lambda
More file actions
34 lines (24 loc) · 869 Bytes
/
Dockerfile.lambda
File metadata and controls
34 lines (24 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Stage 1: Build the Go application
FROM golang:1.25 AS builder
# Set the destination for the application
WORKDIR /go/src/app
# Copy the Go Modules manifests first and download dependencies
COPY go.mod go.sum ./
RUN go mod download
# Copy the rest of the application's source code
COPY . .
# Set build arguments and environment variables
ARG commit_hash
ENV commit_hash $commit_hash
# Build the application
RUN go build -tags lambda.norpc -o main cmd/lambda/main.go
# Stage 2: Create the final image
FROM public.ecr.aws/lambda/provided:al2023
# Copy the built binary from the builder stage
COPY --from=builder /go/src/app/main /main
# Copy secrets if necessary
COPY secrets.json /go/src/app/secrets.json
# Copy templates directory for email templates
COPY --from=builder /go/src/app/templates /go/src/app/templates
# Set the entrypoint
ENTRYPOINT [ "/main" ]