Merge pull request #625 from nspcc-dev/prepare-build-and-publish-images

Prepare build and publish images
This commit is contained in:
Roman Khimov 2020-01-28 13:41:16 +03:00 committed by GitHub
commit 9037cabe1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 7 deletions

View file

@ -1,6 +1,19 @@
#!/bin/sh #!/bin/sh
if test -f /privnet-blocks.acc.gz; then
gunzip /privnet-blocks.acc.gz BIN=/usr/bin/neo-go
/usr/bin/neo-go db restore -i /privnet-blocks.acc
if [ -z "$ACC"]; then
ACC=/6000-privnet-blocks.acc.gz
fi fi
/usr/bin/neo-go "$@"
case $@ in
"node"*)
echo "=> Try to restore blocks before running node"
if test -f $ACC; then
gunzip --stdout /$ACC > /privnet.acc
${BIN} db restore -p --config-path /config -i /privnet.acc
fi
;;
esac
${BIN} "$@"

View file

@ -30,7 +30,8 @@ LABEL version=$VERSION
WORKDIR / WORKDIR /
COPY --from=builder /neo-go/config /config COPY --from=builder /neo-go/config /config
COPY --from=builder /neo-go/.docker/6000-privnet-blocks.acc.gz /privnet-blocks.acc.gz COPY --from=builder /neo-go/.docker/6000-privnet-blocks.acc.gz /6000-privnet-blocks.acc.gz
COPY --from=builder /neo-go/.docker/1600-privnet-blocks-single.acc.gz /1600-privnet-blocks-single.acc.gz
COPY --from=builder /neo-go/.docker/privnet-entrypoint.sh /usr/bin/privnet-entrypoint.sh COPY --from=builder /neo-go/.docker/privnet-entrypoint.sh /usr/bin/privnet-entrypoint.sh
COPY --from=builder /go/bin/neo-go /usr/bin/neo-go COPY --from=builder /go/bin/neo-go /usr/bin/neo-go
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/

View file

@ -14,6 +14,8 @@ REPO ?= "$(shell go list -m)"
VERSION ?= "$(shell git describe --tags 2>/dev/null | sed 's/^v//')" VERSION ?= "$(shell git describe --tags 2>/dev/null | sed 's/^v//')"
BUILD_FLAGS = "-X $(REPO)/config.Version=$(VERSION)" BUILD_FLAGS = "-X $(REPO)/config.Version=$(VERSION)"
IMAGE_REPO=nspccdev/neo-go
# All of the targets are phony here because we don't really use make dependency # All of the targets are phony here because we don't really use make dependency
# tracking for files # tracking for files
.PHONY: build deps image check-version clean-cluster push-tag push-to-registry \ .PHONY: build deps image check-version clean-cluster push-tag push-to-registry \
@ -48,8 +50,13 @@ postinst: install
image: deps image: deps
@echo "=> Building image" @echo "=> Building image"
@docker build -t cityofzion/neo-go:latest --build-arg REPO=$(REPO) --build-arg VERSION=$(VERSION) . @docker build -t $(IMAGE_REPO):latest --build-arg REPO=$(REPO) --build-arg VERSION=$(VERSION) .
@docker build -t cityofzion/neo-go:$(VERSION) --build-arg REPO=$(REPO) --build-arg VERSION=$(VERSION) . @docker build -t $(IMAGE_REPO):$(VERSION) --build-arg REPO=$(REPO) --build-arg VERSION=$(VERSION) .
image-push:
@echo "=> Publish image"
@docker push $(IMAGE_REPO):latest
@docker push $(IMAGE_REPO):$(VERSION)
check-version: check-version:
git fetch && (! git rev-list ${VERSION}) git fetch && (! git rev-list ${VERSION})