Fix the binaries and Docker Images (#306)
* Finally fix the binary builds for a couple os/arch combinations * Make the file executable before adding it to the zip * This cache hack wasn't suppose to make it into the PR * Guard against calling the binary target by itself * Order matters on OS X * Vendored my image * No 386 builds until storage is fixed.
This commit is contained in:
parent
a4d1070d68
commit
2c315db84b
81
Makefile
81
Makefile
@ -166,73 +166,34 @@ deploy:
|
|||||||
.PHONY: binary
|
.PHONY: binary
|
||||||
binary: CUSTOMTAG = -${GOOS}-${GOARCH}
|
binary: CUSTOMTAG = -${GOOS}-${GOARCH}
|
||||||
binary:
|
binary:
|
||||||
|
@if [ -z "${COMPONENT}" ]; then echo "Try one of the following targets instead:" \
|
||||||
|
&& for b in binaries ${BINARIES}; do echo "- $$b"; done && exit 1; fi
|
||||||
mkdir -p release/${TAG}
|
mkdir -p release/${TAG}
|
||||||
CUSTOMTAG=$(CUSTOMTAG) $(MAKE) $(COMPONENT)-image
|
tar -c . | docker run --rm -i -e TAR=1 -e GO111MODULE=on \
|
||||||
cid=$$(docker create storjlabs/$(COMPONENT):${TAG}${CUSTOMTAG}) \
|
-e GOOS=${GOOS} -e GOARCH=${GOARCH} -e CGO_ENABLED=1 \
|
||||||
&& docker cp $$cid:/app/$(COMPONENT) release/${TAG}/$(COMPONENT)_${GOOS}_${GOARCH}${FILEEXT} \
|
-w /go/src/storj.io/storj storjlabs/golang \
|
||||||
&& docker rm $$cid
|
-o app storj.io/storj/cmd/${COMPONENT} \
|
||||||
docker rmi storjlabs/$(COMPONENT):${TAG}${CUSTOMTAG}
|
| tar -O -x ./app > release/${TAG}/$(COMPONENT)_${GOOS}_${GOARCH}${FILEEXT}
|
||||||
|
chmod 755 release/${TAG}/$(COMPONENT)_${GOOS}_${GOARCH}${FILEEXT}
|
||||||
rm -f release/${TAG}/${COMPONENT}_${GOOS}_${GOARCH}.zip
|
rm -f release/${TAG}/${COMPONENT}_${GOOS}_${GOARCH}.zip
|
||||||
cd release/${TAG}; zip ${COMPONENT}_${GOOS}_${GOARCH}.zip ${COMPONENT}_${GOOS}_${GOARCH}${FILEEXT}
|
cd release/${TAG}; zip ${COMPONENT}_${GOOS}_${GOARCH}.zip ${COMPONENT}_${GOOS}_${GOARCH}${FILEEXT}
|
||||||
rm -f release/${TAG}/${COMPONENT}_${GOOS}_${GOARCH}${FILEEXT}
|
rm -f release/${TAG}/${COMPONENT}_${GOOS}_${GOARCH}${FILEEXT}
|
||||||
|
|
||||||
# To update this section, modify and run the following:
|
.PHONY: satellite_%
|
||||||
# for c in satellite storagenode uplink; do \
|
satellite_%:
|
||||||
# for oa in "darwin amd64" "linux 386" \
|
GOOS=$(word 2, $(subst _, ,$@)) GOARCH=$(word 3, $(subst _, ,$@)) COMPONENT=satellite $(MAKE) binary
|
||||||
# "linux amd64" "windows 386" "windows amd64"; do \
|
.PHONY: storagenode_%
|
||||||
# echo "$c $oa"; done; done | while read -r c o a; do; \
|
storagenode_%:
|
||||||
# printf ".PHONY: ${c}_${o}_${a}\n${c}_${o}_${a}:\n\tGOOS=${o} GOARCH=${a} COMPONENT=${c} \$(MAKE) binary\n"; \
|
GOOS=$(word 2, $(subst _, ,$@)) GOARCH=$(word 3, $(subst _, ,$@)) COMPONENT=storagenode $(MAKE) binary
|
||||||
# done
|
.PHONY: uplink_%
|
||||||
.PHONY: satellite_darwin_amd64
|
uplink_%:
|
||||||
satellite_darwin_amd64:
|
GOOS=$(word 2, $(subst _, ,$@)) GOARCH=$(word 3, $(subst _, ,$@)) COMPONENT=uplink $(MAKE) binary
|
||||||
GOOS=darwin GOARCH=amd64 COMPONENT=satellite $(MAKE) binary
|
|
||||||
.PHONY: satellite_linux_386
|
|
||||||
satellite_linux_386:
|
|
||||||
GOOS=linux GOARCH=386 COMPONENT=satellite $(MAKE) binary
|
|
||||||
.PHONY: satellite_linux_amd64
|
|
||||||
satellite_linux_amd64:
|
|
||||||
GOOS=linux GOARCH=amd64 COMPONENT=satellite $(MAKE) binary
|
|
||||||
.PHONY: satellite_windows_386
|
|
||||||
satellite_windows_386:
|
|
||||||
GOOS=windows GOARCH=386 COMPONENT=satellite $(MAKE) binary
|
|
||||||
.PHONY: satellite_windows_amd64
|
|
||||||
satellite_windows_amd64:
|
|
||||||
GOOS=windows GOARCH=amd64 COMPONENT=satellite $(MAKE) binary
|
|
||||||
.PHONY: storagenode_darwin_amd64
|
|
||||||
storagenode_darwin_amd64:
|
|
||||||
GOOS=darwin GOARCH=amd64 COMPONENT=storagenode $(MAKE) binary
|
|
||||||
.PHONY: storagenode_linux_386
|
|
||||||
storagenode_linux_386:
|
|
||||||
GOOS=linux GOARCH=386 COMPONENT=storagenode $(MAKE) binary
|
|
||||||
.PHONY: storagenode_linux_amd64
|
|
||||||
storagenode_linux_amd64:
|
|
||||||
GOOS=linux GOARCH=amd64 COMPONENT=storagenode $(MAKE) binary
|
|
||||||
.PHONY: storagenode_windows_386
|
|
||||||
storagenode_windows_386:
|
|
||||||
GOOS=windows GOARCH=386 COMPONENT=storagenode $(MAKE) binary
|
|
||||||
.PHONY: storagenode_windows_amd64
|
|
||||||
storagenode_windows_amd64:
|
|
||||||
GOOS=windows GOARCH=amd64 COMPONENT=storagenode $(MAKE) binary
|
|
||||||
.PHONY: uplink_darwin_amd64
|
|
||||||
uplink_darwin_amd64:
|
|
||||||
GOOS=darwin GOARCH=amd64 COMPONENT=uplink $(MAKE) binary
|
|
||||||
.PHONY: uplink_linux_386
|
|
||||||
uplink_linux_386:
|
|
||||||
GOOS=linux GOARCH=386 COMPONENT=uplink $(MAKE) binary
|
|
||||||
.PHONY: uplink_linux_amd64
|
|
||||||
uplink_linux_amd64:
|
|
||||||
GOOS=linux GOARCH=amd64 COMPONENT=uplink $(MAKE) binary
|
|
||||||
.PHONY: uplink_windows_386
|
|
||||||
uplink_windows_386:
|
|
||||||
GOOS=windows GOARCH=386 COMPONENT=uplink $(MAKE) binary
|
|
||||||
.PHONY: uplink_windows_amd64
|
|
||||||
uplink_windows_amd64:
|
|
||||||
GOOS=windows GOARCH=amd64 COMPONENT=uplink $(MAKE) binary
|
|
||||||
|
|
||||||
# To update this section, modify and run the following:
|
COMPONENTLIST := uplink satellite storagenode
|
||||||
# grep -Eo '^[a-z]*_[a-z]*_[a-z0-9]*' Makefile | tr '\n' ' '
|
OSARCHLIST := linux_amd64 windows_amd64 darwin_amd64
|
||||||
|
BINARIES := $(foreach C,$(COMPONENTLIST),$(foreach O,$(OSARCHLIST),$C_$O))
|
||||||
.PHONY: binaries
|
.PHONY: binaries
|
||||||
binaries: satellite_darwin_amd64 satellite_linux_386 satellite_linux_amd64 satellite_windows_386 satellite_windows_amd64 storagenode_darwin_amd64 storagenode_linux_386 storagenode_linux_amd64 storagenode_windows_386 storagenode_windows_amd64 uplink_darwin_amd64 uplink_linux_386 uplink_linux_amd64 uplink_windows_386 uplink_windows_amd64
|
binaries: ${BINARIES}
|
||||||
|
|
||||||
.PHONY: binaries-upload
|
.PHONY: binaries-upload
|
||||||
binaries-upload:
|
binaries-upload:
|
||||||
|
@ -1,19 +1,7 @@
|
|||||||
ARG GO_VERSION=1.11
|
ARG CGO_ENABLED=1
|
||||||
FROM golang:${GO_VERSION}-alpine AS build-env
|
ARG REPOSITORY=../storj.io/storj
|
||||||
ARG GOOS=linux
|
ARG PACKAGE=storj.io/storj/cmd/satellite
|
||||||
ARG GOARCH=amd64
|
FROM brimstone/golang as build-env
|
||||||
ARG LDFLAGS=
|
|
||||||
RUN apk add -U curl git musl-dev gcc
|
|
||||||
COPY . /go/src/storj.io/storj
|
|
||||||
ENV GOOS=${GOOS} \
|
|
||||||
GOARCH=${GOARCH} \
|
|
||||||
LDFLAGS=${LDFLAGS} \
|
|
||||||
GOARM=6 \
|
|
||||||
CGO_ENABLED=0 \
|
|
||||||
GO111MODULE=on
|
|
||||||
RUN cd /go/src/storj.io/storj/cmd/satellite \
|
|
||||||
&& go build -o satellite -ldflags "-s -w $LDFLAGS"
|
|
||||||
|
|
||||||
|
|
||||||
# final stage
|
# final stage
|
||||||
FROM alpine
|
FROM alpine
|
||||||
@ -24,7 +12,7 @@ ENV REDIS_ADDR=redis:6379 \
|
|||||||
HTTP_PORT=:8080 \
|
HTTP_PORT=:8080 \
|
||||||
BOOTSTRAP_ADDR=bootstrap.storj.io:8080
|
BOOTSTRAP_ADDR=bootstrap.storj.io:8080
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=build-env /go/src/storj.io/storj/cmd/satellite/satellite /app/
|
COPY --from=build-env /app /app/satellite
|
||||||
COPY cmd/satellite/entrypoint /entrypoint
|
COPY cmd/satellite/entrypoint /entrypoint
|
||||||
EXPOSE 8081/udp \
|
EXPOSE 8081/udp \
|
||||||
8080 \
|
8080 \
|
||||||
|
@ -1,19 +1,7 @@
|
|||||||
ARG GO_VERSION=1.11
|
ARG CGO_ENABLED=1
|
||||||
FROM golang:${GO_VERSION}-alpine AS build-env
|
ARG REPOSITORY=../storj.io/storj
|
||||||
ARG GOOS=linux
|
ARG PACKAGE=storj.io/storj/cmd/storagenode
|
||||||
ARG GOARCH=amd64
|
FROM brimstone/golang as build-env
|
||||||
ARG LDFLAGS=
|
|
||||||
RUN apk add -U curl git musl-dev gcc
|
|
||||||
COPY . /go/src/storj.io/storj
|
|
||||||
ENV GOOS=${GOOS} \
|
|
||||||
GOARCH=${GOARCH} \
|
|
||||||
LDFLAGS=${LDFLAGS} \
|
|
||||||
GOARM=6 \
|
|
||||||
CGO_ENABLED=0 \
|
|
||||||
GO111MODULE=on
|
|
||||||
RUN cd /go/src/storj.io/storj/cmd/storagenode \
|
|
||||||
&& go build -o storagenode -ldflags "-s -w $LDFLAGS"
|
|
||||||
|
|
||||||
|
|
||||||
# final stage
|
# final stage
|
||||||
FROM alpine
|
FROM alpine
|
||||||
@ -22,6 +10,6 @@ ENV CONF_PATH= \
|
|||||||
EXPOSE 7777
|
EXPOSE 7777
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=build-env /go/src/storj.io/storj/cmd/storagenode/storagenode /app/
|
COPY --from=build-env /app /app/storagenode
|
||||||
COPY cmd/storagenode/entrypoint /entrypoint
|
COPY cmd/storagenode/entrypoint /entrypoint
|
||||||
ENTRYPOINT ["/entrypoint"]
|
ENTRYPOINT ["/entrypoint"]
|
||||||
|
@ -1,19 +1,7 @@
|
|||||||
ARG GO_VERSION=1.11
|
ARG CGO_ENABLED=1
|
||||||
FROM golang:${GO_VERSION}-alpine AS build-env
|
ARG REPOSITORY=../storj.io/storj
|
||||||
ARG GOOS=linux
|
ARG PACKAGE=storj.io/storj/cmd/uplink
|
||||||
ARG GOARCH=amd64
|
FROM brimstone/golang as build-env
|
||||||
ARG LDFLAGS=
|
|
||||||
RUN apk add -U curl git musl-dev gcc
|
|
||||||
COPY . /go/src/storj.io/storj
|
|
||||||
ENV GOOS=${GOOS} \
|
|
||||||
GOARCH=${GOARCH} \
|
|
||||||
LDFLAGS=${LDFLAGS} \
|
|
||||||
GOARM=6 \
|
|
||||||
CGO_ENABLED=0 \
|
|
||||||
GO111MODULE=on
|
|
||||||
RUN cd /go/src/storj.io/storj/cmd/uplink \
|
|
||||||
&& go build -o uplink -ldflags "-s -w $LDFLAGS"
|
|
||||||
|
|
||||||
|
|
||||||
# final stage
|
# final stage
|
||||||
FROM alpine
|
FROM alpine
|
||||||
@ -23,6 +11,6 @@ EXPOSE 7777
|
|||||||
|
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=build-env /go/src/storj.io/storj/cmd/uplink/uplink /app/
|
COPY --from=build-env /app /app/uplink
|
||||||
COPY cmd/uplink/entrypoint /entrypoint
|
COPY cmd/uplink/entrypoint /entrypoint
|
||||||
ENTRYPOINT ["/entrypoint"]
|
ENTRYPOINT ["/entrypoint"]
|
||||||
|
@ -3,7 +3,7 @@ set -euo pipefail
|
|||||||
|
|
||||||
|
|
||||||
ids="$(
|
ids="$(
|
||||||
for cid in $(docker ps | awk '/storage-node/{print $1}'); do
|
for cid in $(docker ps -a | awk '/storagenode/{print $1}'); do
|
||||||
ip="$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $cid)"
|
ip="$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $cid)"
|
||||||
id="$(docker logs $cid 2>&1 | awk '/started/{print $5; exit}')"
|
id="$(docker logs $cid 2>&1 | awk '/started/{print $5; exit}')"
|
||||||
echo $id:$ip:7777
|
echo $id:$ip:7777
|
||||||
|
Loading…
Reference in New Issue
Block a user