-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile
55 lines (37 loc) · 1.09 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
ARG repo="evmos"
FROM golang:1.20-bullseye as build-env
ARG commit_hash
ARG repo
ENV PACKAGES curl make git libc-dev bash gcc jq bc
RUN apt-get update && apt-get upgrade -y && \
apt-get install -y $PACKAGES
WORKDIR /go/src/github.com/evmos/
RUN git clone "https://github.com/evmos/$repo.git"
WORKDIR /go/src/github.com/evmos/"$repo"
RUN git checkout ${commit_hash}
RUN make build
FROM golang:1.20-bullseye as final
ARG repo
ARG USER_UID=1000
ARG USER_GID=$USER_UID
ARG USERNAME
ARG extra_flags=""
# Create a non-root user
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME
WORKDIR /home/$USERNAME
RUN apt update -y && apt install jq bc -y
# Copy over binaries from the build-env
COPY --from=build-env /go/src/github.com/evmos/"$repo"/build/"$repo"d .
COPY ./localnet/start.sh ./multi-node-start.sh
COPY ./single-node/start.sh ./single-node-start.sh
ENV EXTRA_FLAGS=${extra_flags}
ENV CHAIN=${repo}
# Set non-root user as default user
USER $USERNAME
ENTRYPOINT ["/bin/bash", "-c"]
EXPOSE 26556
EXPOSE 26657
EXPOSE 9090
EXPOSE 1317
EXPOSE 8545