-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile.golang
46 lines (34 loc) · 1.04 KB
/
Dockerfile.golang
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Builder layer
FROM golang:1.23-alpine as builder
WORKDIR /neo-go
# Install deps:
RUN apk add --no-cache git
ARG REV="v0.106.0"
ARG REPO="github.com/nspcc-dev/neo-go"
# Clone and build repo:
RUN set -x \
&& git clone https://${REPO}.git /neo-go \
&& git checkout ${REV} \
&& export GOGC=off \
&& export CGO_ENABLED=0 \
&& export GO111MODULE=on \
&& export MODULE=$(go list -m) \
&& export VERSION=$(git describe --tags 2>/dev/null | sed 's/^v//') \
&& export LDFLAGS="-X ${MODULE}/config.Version=${VERSION}" \
&& go build \
-v \
-o /go/bin/neo-go \
-trimpath \
-ldflags "${LDFLAGS}" \
./cli
# Executable layer
FROM alpine:3.18
RUN apk add --no-cache iproute2-tc
WORKDIR /neo-go
WORKDIR /
COPY ./go.entrypoint.sh /entrypoint.sh
COPY --from=builder /neo-go/config /config
COPY --from=builder /go/bin/neo-go /usr/bin/neo-go
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
ENTRYPOINT ["/entrypoint.sh"]
CMD ["node", "--config-path", "/config", "--privnet"]