Skip to content

Commit

Permalink
chore(): Fix Dockerfile CMD to take variables (#77)
Browse files Browse the repository at this point in the history
Signed-off-by: Udit Gaurav <[email protected]>
  • Loading branch information
uditgaurav authored Nov 23, 2020
1 parent e11c93a commit bb84046
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
9 changes: 3 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]

16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

# Makefile for building Chaos Exporter
# Reference Guide - https://www.gnu.org/software/make/manual/make.html

Expand Down Expand Up @@ -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)

0 comments on commit bb84046

Please sign in to comment.