-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.control
More file actions
61 lines (44 loc) · 1.62 KB
/
Dockerfile.control
File metadata and controls
61 lines (44 loc) · 1.62 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
FROM golang:1.23-alpine AS builder
WORKDIR /app
# Install build dependencies
RUN apk add --no-cache \
git \
protobuf \
protobuf-dev \
make \
ca-certificates
# Install Go protobuf plugins (pinned versions for compatibility)
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.32.0 && \
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3.0
# Copy proto source file
COPY proto/ ./proto/
# Copy proto module files
COPY control-plane/proto/go.mod control-plane/proto/go.sum ./control-plane/proto/
# Generate protobuf code
RUN mkdir -p control-plane/proto && \
protoc --go_out=. --go_opt=paths=source_relative \
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
proto/proxy.proto && \
mv proto/proxy.pb.go proto/proxy_grpc.pb.go control-plane/proto/
# Download proto module dependencies
WORKDIR /app/control-plane/proto
RUN go mod download
# Copy control-plane go.mod files and download dependencies
WORKDIR /app/control-plane
COPY control-plane/go.mod control-plane/go.sum ./
RUN go mod download
# Copy control-plane source code (cmd, internal, etc.)
COPY control-plane/cmd ./cmd
COPY control-plane/internal ./internal
# Build
RUN go mod tidy && \
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o aegis-control ./cmd/main.go
# Final stage
FROM alpine:latest
RUN apk --no-cache add ca-certificates wget
WORKDIR /root/
COPY --from=builder /app/control-plane/aegis-control .
EXPOSE 9090 9091
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
CMD wget -q -O- http://localhost:9090/health || exit 1
ENTRYPOINT ["./aegis-control"]