# Shibarium bor execution client — BUILT FROM SOURCE.
#
# shibaone publishes NO bor docker image (and vanilla 0xpolygon/bor is the WRONG
# fork — Polygon, chainId 137). We mirror the upstream shibaone/bor Dockerfile
# (`make bor` -> build/bin/bor) but clone the pinned tag so the image is
# self-contained. Running `bor server --chain=shibarium` self-configures the
# shibarium genesis (builder/files/genesis-shibarium.json, chainId 109) and the
# bootnodes bundled in builder/files/config.toml.
#
# Build args:
#   BOR_REPO     - bor source repo   (default: https://github.com/shibaone/bor)
#   BOR_VERSION  - bor version tag   (passed by the template, e.g. v1.3.9-bone)

ARG BOR_REPO=https://github.com/shibaone/bor
ARG BOR_VERSION=v1.3.9-bone

FROM golang:1.22.1

ARG BOR_REPO
ARG BOR_VERSION

RUN apt-get update -y && apt-get upgrade -y \
    && apt-get install -y --no-install-recommends build-essential git ca-certificates \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /var/lib/bor
RUN git clone --depth 1 --branch ${BOR_VERSION} ${BOR_REPO} . \
    && make bor \
    && cp build/bin/bor /usr/bin/

RUN mkdir -p /root/.bor
EXPOSE 8545 8546 8547 30303 30303/udp
ENTRYPOINT ["bor"]
