-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
41 lines (28 loc) · 759 Bytes
/
Dockerfile
File metadata and controls
41 lines (28 loc) · 759 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
35
36
37
38
39
40
41
# Use the official Golang image to create a build artifact.
# This is based on Debian.
FROM golang:1.25 AS local
# Create and change to the app directory.
WORKDIR /app
# Copy local code to the container image.
COPY . ./
# Regenerate the swagger
RUN make swag
CMD ["go", "tool", "air"]
FROM golang:1.25 AS builder
# Create and change to the app directory.
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
# Copy local code to the container image.
COPY . ./
# Regenerate the swagger
RUN make swag
# Build it
RUN GOOS=linux go build -o /api
FROM gcr.io/distroless/base-debian12 AS production
COPY --from=builder /api /api
# Open port 8080 to traffic
EXPOSE 8080
# Specify the command to run on container start.
ENTRYPOINT ["/api"]
CMD ["run"]