-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (22 loc) · 824 Bytes
/
Copy pathDockerfile
File metadata and controls
32 lines (22 loc) · 824 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
# ─── Stage 1: Build ───
FROM golang:1.23-alpine AS builder
RUN apk add --no-cache git make
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
# Build both binaries
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /bin/consus-server ./cmd/server/main.go
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /bin/consus-cli ./cmd/consus-cli/main.go
# ─── Stage 2: Runtime ───
FROM alpine:3.19
RUN apk add --no-cache ca-certificates tzdata
COPY --from=builder /bin/consus-server /usr/local/bin/consus-server
COPY --from=builder /bin/consus-cli /usr/local/bin/consus-cli
# Data directory
RUN mkdir -p /data
VOLUME ["/data"]
# gRPC + HTTP dashboard
EXPOSE 50051 8080
ENTRYPOINT ["consus-server"]
CMD ["--id=node1", "--port=50051", "--http-port=8080", "--data=/data"]