-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
34 lines (25 loc) · 923 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
# First "layer" of the image, only used to build
FROM public.ecr.aws/docker/library/golang:1.22 as builder
# Create a build dir and copy all the things
RUN mkdir /build
COPY . /build
# Set the Current Working Directory inside the container
WORKDIR /build
ENV GIN_MODE=release
# Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed
RUN go mod download
# Build the Go app
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o main .
# Use a really lightweight base environment layer for running
FROM gcr.io/distroless/base:debug
# Copy everything we need to run the service into the dir "app" of the container
COPY --from=builder /build/main /app/
# COPY --from=builder /build/swaggerui /app/swaggerui
# Expose port 8080 and 8125 to the outside world
# router
EXPOSE 8080
# datadog agent
EXPOSE 8125
# Command to run the executable
WORKDIR /app
ENTRYPOINT ["./main"]