Clean up proxy Makefile

Model for the others, make sure dependencies are correct and that
only the exactly correct things are passed to Docker. No longer copy
vendor directory.

Signed-off-by: Justin Cormack <justin@specialbusservice.com>
This commit is contained in:
Justin Cormack 2016-09-10 16:53:54 +01:00 committed by Justin Cormack
parent 91507f1382
commit b69893eb6d
5 changed files with 17 additions and 19 deletions

View File

@ -16,8 +16,8 @@ COPY kernel/$ARCH/kernel-source-info /etc/
ADD kernel/$ARCH/kernel-patches.tar /etc/kernel-patches
ADD kernel/$ARCH/kernel-modules.tar /
COPY packages/proxy/slirp-proxy /usr/bin/
COPY packages/proxy/slirp-proxy /sbin/proxy-vsockd
COPY packages/proxy/proxy /usr/bin/slirp-proxy
COPY packages/proxy/proxy /sbin/proxy-vsockd
COPY packages/proxy/etc /etc/
COPY packages/transfused/transfused /sbin/
COPY packages/transfused/etc /etc/

View File

@ -1,5 +1,5 @@
all:
$(MAKE) -C proxy OS=linux
$(MAKE) -C proxy
$(MAKE) -C diagnostics OS=linux
$(MAKE) -C transfused OS=linux
$(MAKE) -C tap-vsockd OS=linux

View File

@ -1,2 +1,2 @@
/slirp-proxy
/vendor
proxy
files

View File

@ -5,9 +5,6 @@ WORKDIR /go/src/proxy
COPY ./ /go/src/proxy/
ARG GOARCH
ARG GOOS
RUN go install --ldflags '-extldflags "-fno-PIC"'
RUN [ -f /go/bin/*/proxy ] && mv /go/bin/*/proxy /go/bin/ || true
CMD ["tar", "cf", "-", "-C", "/go/bin", "proxy"]

View File

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