clean up diagnostics server build

Signed-off-by: Justin Cormack <justin@specialbusservice.com>
This commit is contained in:
Justin Cormack 2016-09-10 17:46:49 +01:00 committed by Justin Cormack
parent d0c3e873f6
commit 168fdedace
3 changed files with 14 additions and 18 deletions

View File

@ -1,2 +1,2 @@
diagnostics-server diagnostics-server
/vendor files

View File

@ -1,13 +1,9 @@
FROM mobylinux/alpine-build-go:30067067003d565887d7efe533eba03ed46038d2 FROM mobylinux/alpine-build-go:30067067003d565887d7efe533eba03ed46038d2
RUN mkdir -p /go/src/diagnostics COPY ./ /go/src/diagnostics-server/
WORKDIR /go/src/diagnostics
COPY . /go/src/diagnostics WORKDIR /go/src/diagnostics-server
ARG GOARCH
ARG GOOS
RUN go install --ldflags '-extldflags "-fno-PIC"' RUN go install --ldflags '-extldflags "-fno-PIC"'
RUN [ -f /go/bin/*/diagnostics ] && mv /go/bin/*/diagnostics /go/bin/ || true CMD ["tar", "cf", "-", "-C", "/go/bin", "diagnostics-server"]

View File

@ -1,15 +1,15 @@
all: diagnostics-server all: diagnostics-server
.PHONY: vendor files:
vendor: ls Dockerfile *.go > files
mkdir -p ./vendor printf -- '-C\n..\n' >> files
cp -r ../vendor/* ./vendor/ (cd .. && find vendor) >> files
diagnostics-server: Dockerfile main.go vendor diagnostics-server: Dockerfile $(wildcard *.go) ../vendor/manifest files
docker build --build-arg GOOS=$(OS) --build-arg GOARCH=$(ARCH) -t diagnostics:build . tar cf - -T files | docker build -t diagnostics-server:build -
docker run --rm diagnostics:build cat /go/bin/diagnostics > diagnostics-server docker run --rm diagnostics-server:build | tar xf -
chmod 755 diagnostics-server
clean: clean:
rm -rf diagnostics-server vendor rm -rf diagnostics-server files
docker images -q diagnostics:build | xargs docker rmi -f || true
.DELETE_ON_ERROR: