github.com/line/ostracon@v1.0.10-0.20230328032236-7f20145f065d/DOCKER/Dockerfile (about)

     1  # stage 1 Generate Ostracon Binary
     2  FROM golang:1.18-alpine as builder
     3  RUN apk update && \
     4      apk upgrade && \
     5      apk add --no-cache git make gcc libc-dev build-base curl jq bash file gmp-dev clang libtool autoconf automake
     6  COPY / /ostracon
     7  WORKDIR /ostracon
     8  RUN make build-linux
     9  
    10  # stage 2
    11  FROM golang:1.18-alpine
    12  LABEL maintainer="hello@blockchain.line.me"
    13  
    14  # Ostracon will be looking for the genesis file in /ostracon/config/genesis.json
    15  # (unless you change `genesis_file` in config.toml). You can put your config.toml and
    16  # private validator file into /ostracon/config.
    17  #
    18  # The /ostracon/data dir is used by ostracon to store state.
    19  ENV OCHOME /ostracon
    20  
    21  # OS environment setup
    22  # Set user right away for determinism, create directory for persistence and give our user ownership
    23  # jq and curl used for extracting `pub_key` from private validator while
    24  # deploying ostracon with Kubernetes. It is nice to have bash so the users
    25  # could execute bash commands.
    26  RUN apk update && \
    27      apk upgrade && \
    28      apk add --no-cache git make gcc libc-dev build-base curl jq bash file gmp-dev clang libtool autoconf automake && \
    29      addgroup ostracon && \
    30      adduser -S -G ostracon ostracon -h "$OCHOME"
    31  
    32  # Run the container with ostracon by default. (UID=100, GID=1000)
    33  USER ostracon
    34  
    35  WORKDIR $OCHOME
    36  
    37  # p2p, rpc and prometheus port
    38  EXPOSE 26656 26657 26660
    39  
    40  STOPSIGNAL SIGTERM
    41  
    42  COPY --from=builder /ostracon/build/ostracon /usr/bin/ostracon
    43  
    44  # You can overwrite these before the first run to influence
    45  # config.json and genesis.json. Additionally, you can override
    46  # CMD to add parameters to `ostracon node`.
    47  ENV PROXY_APP=kvstore MONIKER=dockernode CHAIN_ID=dockerchain
    48  
    49  COPY ./DOCKER/docker-entrypoint.sh /usr/local/bin/
    50  
    51  ENTRYPOINT ["docker-entrypoint.sh"]
    52  CMD ["node"]
    53  
    54  # Expose the data directory as a volume since there's mutable state in there
    55  VOLUME [ "$OCHOME" ]
    56