Skip to content

Commit c913fa0

Browse files
buildx dockerfile.dind
1 parent f06e263 commit c913fa0

File tree

2 files changed

+36
-10
lines changed

2 files changed

+36
-10
lines changed

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,12 @@ output/windows_amd64/test/bin/%.exe: $(PKG_SOURCES)
149149
-tags "$(WINDOWS_BUILD_TAGS)" \
150150
./test/e2e/$(subst -,,$*)
151151

152+
# =x86_64-linux-gnu-gcc need yum install gcc-x86_64-linux-gnu.x86_64
153+
152154
output/linux_amd64/bin/%: $(PKG_SOURCES)
153155
GOOS=linux GOARCH=amd64 CGO_ENABLED=$(CGO_ENABLED) GO111MODULE=on \
154-
CC=x86_64-linux-gnu-gcc go build \
156+
# CC=x86_64-linux-gnu-gcc go build \
157+
CC=x86_64-redhat-linux-gcc go build \
155158
-mod vendor \
156159
-o $@ \
157160
-ldflags '-X $(PKG)/pkg/version.version=$(VERSION)' \
@@ -161,7 +164,8 @@ output/linux_amd64/bin/%: $(PKG_SOURCES)
161164

162165
output/linux_amd64/test/bin/%: $(PKG_SOURCES)
163166
GOOS=linux GOARCH=amd64 CGO_ENABLED=$(CGO_ENABLED) GO111MODULE=on \
164-
CC=x86_64-linux-gnu-gcc go build \
167+
# CC=x86_64-linux-gnu-gcc go build \
168+
CC=x86_64-redhat-linux-gcc go build \
165169
-mod vendor \
166170
-o $@ \
167171
-tags "$(LINUX_BUILD_TAGS)" \

builder/Dockerfile.dind

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
ARG GO_VERSION=1.17
2-
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION} as gobase
2+
FROM --platform=$TARGETPLATFORM golang:${GO_VERSION} as gobase
33
ENV GOBIN /usr/local/go/bin
44

5-
FROM --platform=$BUILDPLATFORM centos:centos8 AS build-env
5+
FROM --platform=$TARGETPLATFORM centos:centos8 AS builder
66
ARG TARGETPLATFORM
77
ARG BUILDPLATFORM
88
ARG BUILDARCH
@@ -47,11 +47,12 @@ RUN yum -y update; yum clean all; \
4747
yum -y install systemd; yum clean all; \
4848
yum -y install libsystemd-dev; yum clean all;\
4949
yum -y install systemd-devel; yum clean all;\
50+
yum -y install gcc-x86_64-linux-gnu.x86_64; yum clean all;\
51+
yum -y install docker-ce-19.03.15; yum clean all;\
5052
yum -y install make automake gcc gcc-c++ kernel-devel; yum clean all;
5153

5254

5355

54-
5556
#######################################################
5657

5758
ENV GO111MODULE=on
@@ -60,16 +61,37 @@ ENV GOPROXY=https://goproxy.cn,direct
6061
ADD . /src/github.com/AliyunContainerService/node-problem-detector
6162
ENV GOPATH /:/src/github.com/AliyunContainerService/node-problem-detector/vendor
6263
WORKDIR /src/github.com/AliyunContainerService/node-problem-detector
63-
RUN pwd
64-
RUN ls
6564

6665
RUN # VERSION="{{.VERSION}}"
6766
RUN # IMAGES="{{.VERSION}}"
6867
RUN # REGIONS="{{.REGIONS}}"
6968
RUN # LOG_LEVEL="{{.LOG_LEVEL}}"
7069
# RUN ls /src/github.com/AliyunContainerService/node-problem-detector/
71-
# RUN cd /workspace/source/src/github.com/AliyunContainerService/node-problem-detector/
72-
RUN make ENABLE_JOURNALD=1
70+
# RUN cd /src/github.com/AliyunContainerService/node-problem-detector/
71+
72+
RUN make build-binaries LINUX_PLATFORMS=linux_$TARGETARCH
73+
RUN make build-tar LINUX_PLATFORMS=linux_$TARGETARCH
74+
75+
RUN ls -lR /src/github.com/AliyunContainerService/node-problem-detector/config
76+
77+
RUN ls -l /src/github.com/AliyunContainerService/node-problem-detector/
78+
79+
#######################################################
80+
81+
82+
FROM --platform=$TARGETPLATFORM centos:centos8
83+
MAINTAINER KeyOfSpectator <[email protected]>
84+
85+
RUN systemctl --version
86+
87+
# RUN clean-install util-linux libsystemd0 systemd bash lsof curl
88+
89+
# Avoid symlink of /etc/localtime.
90+
RUN test -h /etc/localtime && rm -f /etc/localtime && cp /usr/share/zoneinfo/UTC /etc/localtime || true
7391

92+
COPY --from=builder /src/github.com/AliyunContainerService/node-problem-detector/bin/node-problem-detector /node-problem-detector
93+
COPY --from=builder /src/github.com/AliyunContainerService/node-problem-detector/bin/health-checker ${LOGCOUNTER} /home/kubernetes/bin/
7494

75-
#######################################################
95+
COPY --from=builder /src/github.com/AliyunContainerService/node-problem-detector/config /config
96+
RUN chmod +x /config/plugin/*.sh
97+
CMD "/node-problem-detector", "--config.system-log-monitor=/config/kernel-monitor.json"

0 commit comments

Comments
 (0)