-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
39 lines (26 loc) · 862 Bytes
/
Dockerfile
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
35
36
37
38
39
# syntax=docker/dockerfile:1
# Build the application from source
FROM golang:1.20 AS build-stage
# Set destination for COPY
WORKDIR /app
# Download Go modules
COPY go.mod go.sum ./
RUN go mod download
# Copy the source code
COPY *.go ./
# Build
RUN CGO_ENABLED=0 GOOS=linux go build -o /transactions-email-processor
# Run the tests in the container
FROM build-stage AS run-test-stage
RUN go test -v ./...
# Deploy the application binary into a lean image
FROM gcr.io/distroless/base-debian11 AS build-release-stage
WORKDIR /
COPY --from=build-stage /transactions-email-processor /transactions-email-processor
# Copy project assets
COPY email/dist/email_template.html email/
USER nonroot:nonroot
ENV SENDER_MAIL="[email protected]"
ENV PASSWORD="secret-password"
ENV RECIPIENT_MAIL="[email protected]"
ENTRYPOINT ["/transactions-email-processor"]