# Copyright 2023 Foster Hangdaan # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ARG VERSION=v0.10.0 # ----------- # Build Stage # ----------- FROM docker.io/library/debian:12-slim as builder RUN set -ex && \ DEBIAN_FRONTEND=noninteractive apt-get update -qqy && \ DEBIAN_FRONTEND=noninteractive apt-get install -qqy librocksdb-dev curl cargo clang cmake git ARG VERSION WORKDIR /build RUN git clone --depth 1 --branch ${VERSION} https://github.com/romanz/electrs.git . ENV ROCKSDB_INCLUDE_DIR=/usr/include ENV ROCKSDB_LIB_DIR=/usr/lib RUN cargo build --locked --release --bin electrs # ------------- # Runtime Stage # ------------- FROM docker.io/library/debian:12-slim LABEL maintainer="Foster Hangdaan " RUN set -ex && \ DEBIAN_FRONTEND=noninteractive apt-get update -qqy && \ DEBIAN_FRONTEND=noninteractive apt-get install -qqy librocksdb-dev curl COPY --from=builder /build/target/release/electrs /usr/bin/electrs RUN adduser --system --group --disabled-password --home /electrs electrs RUN mkdir -p /etc/electrs USER electrs RUN mkdir -p /electrs/db /electrs/.bitcoin /electrs/.electrs # Data directory VOLUME /electrs/db # Bitcoin daemon data VOLUME /electrs/.bitcoin # Config directories VOLUME /etc/electrs /electrs/.electrs # Electrum RPC - Mainnet EXPOSE 50001 # Prometheus Monitoring EXPOSE 4224 ENTRYPOINT ["electrs"]