Remove Dockerfile.in rewrite hack and use updated arg in Dockerfile

This commit is contained in:
Jeremy Edwards
2020-12-08 06:31:29 +00:00
parent 8f2a94fd7e
commit aadb16b3d4
3 changed files with 15 additions and 17 deletions
-1
View File
@@ -1,5 +1,4 @@
/bin/
/Dockerfile
/test/bin/
/*.tar.gz
ci.env
+8 -7
View File
@@ -12,7 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
FROM @BASEIMAGE@
ARG BASEIMAGE
FROM ${BASEIMAGE}
MAINTAINER Random Liu <lantaol@google.com>
RUN clean-install util-linux libsystemd0 bash
@@ -20,11 +22,10 @@ RUN clean-install util-linux libsystemd0 bash
# Avoid symlink of /etc/localtime.
RUN test -h /etc/localtime && rm -f /etc/localtime && cp /usr/share/zoneinfo/UTC /etc/localtime || true
ADD ./bin/node-problem-detector /node-problem-detector
ADD ./bin/health-checker /home/kubernetes/bin/health-checker
COPY ./bin/node-problem-detector /node-problem-detector
# Below command depends on ENABLE_JOURNAL=1.
ADD ./bin/log-counter /home/kubernetes/bin/log-counter
ARG LOGCOUNTER
COPY ./bin/health-checker ${LOGCOUNTER} /home/kubernetes/bin/
ADD config /config
ENTRYPOINT ["/node-problem-detector", "--system-log-monitors=/config/kernel-monitor.json"]
COPY config /config
ENTRYPOINT ["/node-problem-detector", "--config.system-log-monitor=/config/kernel-monitor.json"]
+7 -9
View File
@@ -64,6 +64,7 @@ CGO_ENABLED:=0
# Construct the "-tags" parameter used by "go build".
BUILD_TAGS?=
ifeq ($(ENABLE_JOURNALD), 1)
# Enable journald build tag.
BUILD_TAGS:=$(BUILD_TAGS) journald
@@ -73,6 +74,11 @@ ifeq ($(ENABLE_JOURNALD), 1)
# here, because go-systemd uses dlopen, and dlopen will not work properly in a
# statically linked application.
CGO_ENABLED:=1
LOGCOUNTER=./bin/log-counter
else
# Hack: Don't copy over log-counter, use a wildcard path that shouldnt match
# anything in COPY command.
LOGCOUNTER=*dont-include-log-counter
endif
vet:
@@ -175,14 +181,6 @@ endif
-tags "$(BUILD_TAGS)" \
cmd/healthchecker/health_checker.go
Dockerfile: Dockerfile.in
sed -e 's|@BASEIMAGE@|$(BASEIMAGE)|g' $< >$@
ifneq ($(ENABLE_JOURNALD), 1)
sed -i '/Below command depends on ENABLE_JOURNAL=1/,+2d' $@
echo "Warning: log-counter requires journald, skipping."
endif
test: vet fmt
GO111MODULE=on go test -mod vendor -timeout=1m -v -race -short -tags "$(BUILD_TAGS)" ./...
@@ -199,7 +197,7 @@ e2e-test: vet fmt build-tar
build-binaries: ./bin/node-problem-detector ./bin/log-counter ./bin/health-checker
build-container: build-binaries Dockerfile
docker build -t $(IMAGE) .
docker build -t $(IMAGE) --build-arg BASEIMAGE=$(BASEIMAGE) --build-arg LOGCOUNTER=$(LOGCOUNTER) .
build-tar: ./bin/node-problem-detector ./bin/log-counter ./bin/health-checker ./test/bin/problem-maker
tar -zcvf $(TARBALL) bin/ config/ test/e2e-install.sh test/bin/problem-maker