forked from TrueCloudLab/neoneo-go
Merge pull request #981 from aprasolova/feature/dockerfile
Clean build in Dockerfile
This commit is contained in:
commit
ff0241ed07
2 changed files with 6 additions and 10 deletions
13
Dockerfile
13
Dockerfile
|
@ -2,7 +2,7 @@
|
||||||
FROM golang:1-alpine as builder
|
FROM golang:1-alpine as builder
|
||||||
|
|
||||||
RUN set -x \
|
RUN set -x \
|
||||||
&& apk add --no-cache git \
|
&& apk add --no-cache git make \
|
||||||
&& mkdir -p /tmp
|
&& mkdir -p /tmp
|
||||||
|
|
||||||
COPY . /neo-go
|
COPY . /neo-go
|
||||||
|
@ -12,14 +12,7 @@ WORKDIR /neo-go
|
||||||
ARG REPO=repository
|
ARG REPO=repository
|
||||||
ARG VERSION=dev
|
ARG VERSION=dev
|
||||||
|
|
||||||
# https://github.com/golang/go/wiki/Modules#how-do-i-use-vendoring-with-modules-is-vendoring-going-away
|
RUN make
|
||||||
# go build -mod=vendor
|
|
||||||
RUN set -x \
|
|
||||||
&& export GOGC=off \
|
|
||||||
&& export GO111MODULE=on \
|
|
||||||
&& export CGO_ENABLED=0 \
|
|
||||||
&& export LDFLAGS="-X ${REPO}/config.Version=${VERSION}" \
|
|
||||||
&& go build -v -mod=vendor -ldflags "${LDFLAGS}" -o /go/bin/neo-go ./cli
|
|
||||||
|
|
||||||
# Executable image
|
# Executable image
|
||||||
FROM alpine
|
FROM alpine
|
||||||
|
@ -33,7 +26,7 @@ COPY --from=builder /neo-go/config /config
|
||||||
COPY --from=builder /neo-go/.docker/6000-privnet-blocks.acc.gz /6000-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/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 /neo-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/
|
||||||
|
|
||||||
ENTRYPOINT ["/usr/bin/privnet-entrypoint.sh"]
|
ENTRYPOINT ["/usr/bin/privnet-entrypoint.sh"]
|
||||||
|
|
3
Makefile
3
Makefile
|
@ -61,6 +61,9 @@ image-push:
|
||||||
check-version:
|
check-version:
|
||||||
git fetch && (! git rev-list ${VERSION})
|
git fetch && (! git rev-list ${VERSION})
|
||||||
|
|
||||||
|
version:
|
||||||
|
@echo ${VERSION}
|
||||||
|
|
||||||
deps:
|
deps:
|
||||||
@go mod tidy -v
|
@go mod tidy -v
|
||||||
@go mod vendor
|
@go mod vendor
|
||||||
|
|
Loading…
Reference in a new issue