forked from alibaba/kubeskoop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
53 lines (42 loc) · 1.83 KB
/
Dockerfile
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
FROM docker.io/library/golang:1.22.1-alpine AS build
ARG ALPINE_MIRROR
ENV ALPINE_MIRROR=$ALPINE_MIRROR
RUN if [ ! -z "$ALPINE_MIRROR" ]; then sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories; fi && \
apk add gcc g++ linux-headers git make bash
WORKDIR /go/src/github.com/alibaba/kubeskoop/
RUN go env -w GOMODCACHE=/root/.cache/go-build
COPY go.mod go.sum /go/src/github.com/alibaba/kubeskoop/
RUN --mount=type=cache,target=/root/.cache/go-build go mod download
ADD . /go/src/github.com/alibaba/kubeskoop/
RUN --mount=type=cache,target=/root/.cache/go-build mkdir -p bin && make all
FROM --platform=linux/amd64 docker.io/library/node:20.9.0-alpine as build-ui
WORKDIR /webconsole
ADD ./webui /webconsole
RUN yarn install && yarn build
FROM docker.io/library/alpine:3.19 as base
ARG ALPINE_MIRROR
ENV ALPINE_MIRROR=$ALPINE_MIRROR
RUN if [ ! -z "$ALPINE_MIRROR" ]; then sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories; fi && \
apk add --no-cache \
iproute2 \
ipset \
iptables \
iptables-legacy \
ipvsadm \
jq \
strace \
tcpdump \
curl \
bash && \
rm -rf /var/cache/apk/*
FROM base as agent
COPY --from=build /go/src/github.com/alibaba/kubeskoop/bin/inspector /bin/inspector
COPY --from=build /go/src/github.com/alibaba/kubeskoop/bin/pod-collector /bin/pod-collector
COPY --from=build /go/src/github.com/alibaba/kubeskoop/bin/btfhack /bin/btfhack
FROM base as controller
COPY --from=build /go/src/github.com/alibaba/kubeskoop/bin/controller /bin/controller
COPY --from=build /go/src/github.com/alibaba/kubeskoop/bin/skoop /bin/skoop
COPY --from=build /go/src/github.com/alibaba/kubeskoop/bin/webconsole /bin/webconsole
COPY --from=build-ui /webconsole/build /var/www
COPY tools/scripts/* /bin/
COPY deploy/resource/kubeskoop-exporter-dashboard.json /etc/