diff --git a/Dockerfile b/Dockerfile index c55ffac7..0e9214ec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,13 @@ FROM ubuntu:16.04 ARG TARGETARCH +ENV EXPORTER=/exporter-${TARGETARCH} RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/cache/apk/* -COPY ./exporter-${TARGETARCH} / +COPY .$EXPORTER / EXPOSE 8080 -CMD ["/exporter-${TARGETARCH}"] - - - - +CMD ["sh", "-c","$EXPORTER"] diff --git a/Makefile b/Makefile index 4795a418..75d2b943 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,4 @@ + # Makefile for building Chaos Exporter # Reference Guide - https://www.gnu.org/software/make/manual/make.html @@ -118,3 +119,18 @@ unused-package-check: if [ -n "$${tidy}" ]; then \ echo "go mod tidy checking failed!"; echo "$${tidy}"; echo; \ fi + +.PHONY: build-amd64 +build-amd64: + @echo "-------------------------" + @echo "--> Build chaos-exporter image" + @echo "-------------------------" + @sudo docker build --file Dockerfile --tag $(DOCKER_REPO)/$(DOCKER_IMAGE):$(DOCKER_TAG) . --build-arg TARGETARCH=amd64 + +.PHONY: push-amd64 +push-amd64: + + @echo "------------------------------" + @echo "--> Pushing image" + @echo "------------------------------" + @sudo docker push $(DOCKER_REPO)/$(DOCKER_IMAGE):$(DOCKER_TAG)