Multi-arch containerized build for Cadvisor (#2323)
* ppc64le build for cAdvisor
This commit is contained in:
parent
236f41d419
commit
d0f2717c77
14
Makefile
14
Makefile
@ -14,6 +14,14 @@
|
|||||||
|
|
||||||
GO := go
|
GO := go
|
||||||
pkgs = $(shell $(GO) list ./... | grep -v vendor)
|
pkgs = $(shell $(GO) list ./... | grep -v vendor)
|
||||||
|
arch ?= $(shell go env GOARCH)
|
||||||
|
|
||||||
|
ifeq ($(arch), amd64)
|
||||||
|
Dockerfile_tag := ''
|
||||||
|
else
|
||||||
|
Dockerfile_tag := '.''$(arch)'
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
all: presubmit build test
|
all: presubmit build test
|
||||||
|
|
||||||
@ -40,7 +48,7 @@ vet:
|
|||||||
|
|
||||||
build: assets
|
build: assets
|
||||||
@echo ">> building binaries"
|
@echo ">> building binaries"
|
||||||
@./build/build.sh
|
@./build/build.sh $(arch)
|
||||||
|
|
||||||
assets:
|
assets:
|
||||||
@echo ">> building assets"
|
@echo ">> building assets"
|
||||||
@ -50,8 +58,8 @@ release:
|
|||||||
@echo ">> building release binaries"
|
@echo ">> building release binaries"
|
||||||
@./build/release.sh
|
@./build/release.sh
|
||||||
|
|
||||||
docker:
|
docker-%:
|
||||||
@docker build -t cadvisor:$(shell git rev-parse --short HEAD) -f deploy/Dockerfile .
|
@docker build -t cadvisor:$(shell git rev-parse --short HEAD) -f deploy/Dockerfile$(Dockerfile_tag) .
|
||||||
|
|
||||||
presubmit: vet
|
presubmit: vet
|
||||||
@echo ">> checking go formatting"
|
@echo ">> checking go formatting"
|
||||||
|
@ -20,6 +20,7 @@ GO_FLAGS=${GO_FLAGS:-"-tags netgo"} # Extra go flags to use in the build.
|
|||||||
BUILD_USER=${BUILD_USER:-"${USER}@${HOSTNAME}"}
|
BUILD_USER=${BUILD_USER:-"${USER}@${HOSTNAME}"}
|
||||||
BUILD_DATE=${BUILD_DATE:-$( date +%Y%m%d-%H:%M:%S )}
|
BUILD_DATE=${BUILD_DATE:-$( date +%Y%m%d-%H:%M:%S )}
|
||||||
VERBOSE=${VERBOSE:-}
|
VERBOSE=${VERBOSE:-}
|
||||||
|
GOARCH=$1
|
||||||
|
|
||||||
repo_path="github.com/google/cadvisor"
|
repo_path="github.com/google/cadvisor"
|
||||||
|
|
||||||
@ -49,6 +50,12 @@ if [ -n "$VERBOSE" ]; then
|
|||||||
echo "Building with -ldflags $ldflags"
|
echo "Building with -ldflags $ldflags"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
GOBIN=$PWD go build ${GO_FLAGS} -ldflags "${ldflags}" "${repo_path}"
|
|
||||||
|
if [ -z "$GOARCH" ]
|
||||||
|
then
|
||||||
|
GOBIN=$PWD go build ${GO_FLAGS} -ldflags "${ldflags}" "${repo_path}"
|
||||||
|
else
|
||||||
|
GOBIN=$PWD env GOOS=linux GOARCH=$GOARCH go build ${GO_FLAGS} -ldflags "${ldflags}" "${repo_path}"
|
||||||
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
18
deploy/Dockerfile.ppc64le
Normal file
18
deploy/Dockerfile.ppc64le
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
FROM ppc64le/alpine:3.10
|
||||||
|
MAINTAINER dashpole@google.com lysannef@us.ibm.com
|
||||||
|
|
||||||
|
RUN apk --no-cache add libc6-compat device-mapper findutils zfs && \
|
||||||
|
apk --no-cache add thin-provisioning-tools --repository http://dl-3.alpinelinux.org/alpine/edge/main/ && \
|
||||||
|
echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' >> /etc/nsswitch.conf && \
|
||||||
|
rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
|
# Grab cadvisor from the staging directory.
|
||||||
|
ADD cadvisor /usr/bin/cadvisor
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
|
||||||
|
HEALTHCHECK --interval=30s --timeout=3s \
|
||||||
|
CMD wget --quiet --tries=1 --spider http://localhost:8080/healthz || exit 1
|
||||||
|
|
||||||
|
ENTRYPOINT ["/usr/bin/cadvisor", "-logtostderr"]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user