forked from evmos/evmos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
67 lines (50 loc) · 1.65 KB
/
Dockerfile
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
FROM golang:1.23.2-alpine3.20 AS build-env
ARG DB_BACKEND=goleveldb
ARG ROCKSDB_VERSION="9.7.3"
WORKDIR /go/src/github.com/evmos/evmos
COPY go.mod go.sum ./
RUN set -eux; apk add --no-cache \
ca-certificates \
build-base \
git \
linux-headers \
bash \
binutils-gold
RUN --mount=type=bind,target=. --mount=type=secret,id=GITHUB_TOKEN \
git config --global url."https://$(cat /run/secrets/GITHUB_TOKEN)@github.com/".insteadOf "https://github.com/"; \
go mod download
COPY . .
RUN mkdir -p /target/usr/lib /target/usr/local/lib /target/usr/include
RUN if [ "$DB_BACKEND" = "rocksdb" ]; then \
make build-rocksdb; \
cp -r /usr/lib/* /target/usr/lib/ && \
cp -r /usr/local/lib/* /target/usr/local/lib/ && \
cp -r /usr/include/* /target/usr/include/; \
else \
# Build default binary with corresponding db backend
COSMOS_BUILD_OPTIONS=$DB_BACKEND make build; \
fi
RUN go install github.com/MinseokOh/toml-cli@latest
FROM alpine:3.20
WORKDIR /root
COPY --from=build-env /go/src/github.com/evmos/evmos/build/evmosd /usr/bin/evmosd
COPY --from=build-env /go/bin/toml-cli /usr/bin/toml-cli
# required for rocksdb build
COPY --from=build-env /target/usr/lib /usr/lib
COPY --from=build-env /target/usr/local/lib /usr/local/lib
COPY --from=build-env /target/usr/include /usr/include
RUN apk add --no-cache \
ca-certificates \
jq \
curl \
bash \
vim \
lz4 \
rclone \
&& addgroup -g 1000 evmos \
&& adduser -S -h /home/evmos -D evmos -u 1000 -G evmos
USER 1000
WORKDIR /home/evmos
EXPOSE 26656 26657 1317 9090 8545 8546
HEALTHCHECK CMD curl --fail http://localhost:26657 || exit 1
CMD ["evmosd"]