-
Notifications
You must be signed in to change notification settings - Fork 69
/
Dockerfile.api
30 lines (18 loc) · 948 Bytes
/
Dockerfile.api
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
FROM golang:1.22 as builder
COPY go.mod go.sum /go/src/github.com/moira-alert/moira/
WORKDIR /go/src/github.com/moira-alert/moira
RUN go mod download
RUN go install github.com/swaggo/swag/cmd/[email protected]
COPY . /go/src/github.com/moira-alert/moira/
RUN /go/bin/swag init -g api/handler/handler.go
ARG GO_VERSION="GoVersion"
ARG GIT_COMMIT="git_Commit"
ARG MoiraVersion="MoiraVersion"
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags "-X main.MoiraVersion=${MoiraVersion} -X main.GoVersion=${GO_VERSION} -X main.GitCommit=${GIT_COMMIT}" -o build/api github.com/moira-alert/moira/cmd/api
FROM alpine:3.18.0
RUN apk add --no-cache ca-certificates && update-ca-certificates
COPY pkg/api/api.yml /etc/moira/api.yml
COPY --from=builder /go/src/github.com/moira-alert/moira/build/api /usr/bin/api
COPY --from=builder /usr/local/go/lib/time/zoneinfo.zip /usr/local/go/lib/time/
EXPOSE 8081 8081
ENTRYPOINT ["/usr/bin/api"]