-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
35 lines (23 loc) · 810 Bytes
/
Copy pathDockerfile
File metadata and controls
35 lines (23 loc) · 810 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
FROM golang:1.23.1-alpine AS builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN go build -o bin/agentServer cmd/server/main.go
RUN go build -o bin/agent cmd/agent/main.go
FROM alpine:latest
RUN apk add --no-cache bash curl
RUN ARCH=$(uname -m) && \
if [ "$ARCH" = "x86_64" ]; then \
curl -LO "https://dl.k8s.io/release/v1.32.0/bin/linux/amd64/kubectl"; \
elif [ "$ARCH" = "aarch64" ]; then \
curl -LO "https://dl.k8s.io/release/v1.32.0/bin/linux/arm64/kubectl"; \
else \
echo "Unsupported architecture"; exit 1; \
fi && \
chmod +x kubectl && \
mv kubectl /usr/local/bin/
WORKDIR /app
COPY --from=builder /app/bin/agentServer /app/bin/agentServer
COPY --from=builder /app/bin/agent /app/bin/agent
CMD ["/app/bin/agentServer"]