2023-10-22 20:32:09 -04:00
|
|
|
# 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.
|
|
|
|
|
|
|
|
|
2023-12-31 19:29:37 -05:00
|
|
|
ARG VERSION=v0.10.2
|
2023-10-22 20:32:09 -04:00
|
|
|
|
|
|
|
# -----------
|
|
|
|
# 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 <foster@hangdaan.email>"
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2023-10-23 15:35:43 -04:00
|
|
|
RUN mkdir -p /etc/electrs
|
|
|
|
|
2023-10-22 20:32:09 -04:00
|
|
|
USER electrs
|
|
|
|
|
2023-10-23 15:35:43 -04:00
|
|
|
RUN mkdir -p /electrs/db /electrs/.bitcoin /electrs/.electrs
|
2023-10-22 20:32:09 -04:00
|
|
|
|
|
|
|
# Data directory
|
|
|
|
VOLUME /electrs/db
|
|
|
|
|
|
|
|
# Bitcoin daemon data
|
|
|
|
VOLUME /electrs/.bitcoin
|
|
|
|
|
2023-10-23 15:35:43 -04:00
|
|
|
# Config directories
|
|
|
|
VOLUME /etc/electrs /electrs/.electrs
|
|
|
|
|
2023-10-22 20:32:09 -04:00
|
|
|
# Electrum RPC - Mainnet
|
|
|
|
EXPOSE 50001
|
|
|
|
|
|
|
|
# Prometheus Monitoring
|
|
|
|
EXPOSE 4224
|
|
|
|
|
|
|
|
ENTRYPOINT ["electrs"]
|