forked from celestiaorg/celestia-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile_txsim
59 lines (48 loc) · 1.53 KB
/
Dockerfile_txsim
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
# Stage 1: generate celestia-appd binary
FROM --platform=$BUILDPLATFORM docker.io/golang:1.21.6-alpine3.18 as builder
ARG TARGETOS
ARG TARGETARCH
ENV CGO_ENABLED=0
ENV GO111MODULE=on
# hadolint ignore=DL3018
RUN apk update && apk add --no-cache \
gcc \
git \
# linux-headers are needed for Ledger support
linux-headers \
make \
musl-dev
COPY . /celestia-app
WORKDIR /celestia-app
# we need the celestia-appd build as we might want to create an account
# internally for txsimulation
RUN uname -a &&\
CGO_ENABLED=${CGO_ENABLED} GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
make build && make txsim-build
# Stage 2: create a minimal image with the binary
FROM docker.io/alpine:3.19.0
# Use UID 10,001 because UIDs below 10,000 are a security risk.
# Ref: https://github.com/hexops/dockerfile/blob/main/README.md#do-not-use-a-uid-below-10000
ARG UID=10001
ARG USER_NAME=celestia
ENV CELESTIA_HOME=/home/${USER_NAME}
# hadolint ignore=DL3018
RUN apk update && apk add --no-cache \
bash \
curl \
jq \
# Creates a user with $UID and $GID=$UID
&& adduser ${USER_NAME} \
-D \
-g ${USER_NAME} \
-h ${CELESTIA_HOME} \
-s /sbin/nologin \
-u ${UID}
# Copy in the celestia-appd binary
COPY --from=builder /celestia-app/build/celestia-appd /bin/celestia-appd
COPY --from=builder /celestia-app/build/txsim /bin/txsim
COPY --chown=${USER_NAME}:${USER_NAME} docker/txsim.sh /opt/entrypoint.sh
USER ${USER_NAME}
# grpc, rpc, api ports
EXPOSE 26657 1317 9090
ENTRYPOINT [ "/bin/bash", "/opt/entrypoint.sh" ]