Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions a808b51d0d9301fa82390b985c57551966001f9b/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,38 @@
# Electrs build stage
FROM rust:latest AS builder

ARG COMMIT=253040e346664976c12e6c214ee2858a4dad2e06

ENV WS_PORT=1234
ENV ELECTRUM_PORT=50001

RUN apt-get update
RUN apt-get install -y clang cmake
RUN apt-get install -y clang cmake

RUN git clone https://github.com/blockstream/electrs && cd electrs && git checkout ${COMMIT}

WORKDIR /electrs

RUN cargo build --release --bin electrs

FROM debian:stable-slim AS websocat-installer

RUN apt-get update
RUN apt-get install -y wget

RUN wget https://github.com/vi/websocat/releases/download/v1.11.0/websocat.x86_64-unknown-linux-musl \
&& chmod +x websocat.x86_64-unknown-linux-musl \
&& mv websocat.x86_64-unknown-linux-musl /usr/local/bin/websocat

# Final stage
FROM debian:stable-slim

WORKDIR /build
COPY --from=builder /electrs/target/release/electrs /usr/local/bin
COPY --from=websocat-installer /usr/local/bin/websocat /usr/local/bin

COPY --from=builder /electrs/target/release/electrs /build
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

STOPSIGNAL SIGINT

ENTRYPOINT ["/build/electrs"]
ENTRYPOINT /entrypoint.sh ${WS_PORT} ${ELECTRUM_PORT}
20 changes: 18 additions & 2 deletions a808b51d0d9301fa82390b985c57551966001f9b/Dockerfile.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ FROM rust:latest AS builder

ARG COMMIT=a808b51d0d9301fa82390b985c57551966001f9b

ENV WS_PORT=1234
ENV ELECTRUM_PORT=50001

RUN apt-get update
RUN apt-get install -y clang cmake

Expand All @@ -11,12 +14,25 @@ WORKDIR /electrs

RUN cargo build --features liquid --release --bin electrs

FROM debian:stable-slim AS websocat-installer

RUN apt-get update
RUN apt-get install -y wget

RUN wget https://github.com/vi/websocat/releases/download/v1.11.0/websocat.x86_64-unknown-linux-musl \
&& chmod +x websocat.x86_64-unknown-linux-musl \
&& mv websocat.x86_64-unknown-linux-musl /usr/local/bin/websocat

FROM debian:stable-slim

WORKDIR /build

COPY --from=builder /electrs/target/release/electrs /build
COPY --from=builder /electrs/target/release/electrs /usr/local/bin
COPY --from=websocat-installer /usr/local/bin/websocat /usr/local/bin

COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

STOPSIGNAL SIGINT

ENTRYPOINT ["/build/electrs"]
ENTRYPOINT /entrypoint.sh ${WS_PORT} ${ELECTRUM_PORT}
16 changes: 16 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

PORT=$1
ELECTRUM_RPC_PORT=$2

if [ -z "$PORT" ] || [ -z "$ELECTRUM_RPC_PORT" ]; then
echo "Usage: $0 <WS_PORT> <ELECTRUM_RPC_PORT>"
exit 1
fi

echo "Starting websocket server on port $PORT"

set -m
electrs&
websocat -b ws-l:127.0.0.1:$PORT tcp:127.0.0.1:$ELECTRUM_RPC_PORT&
fg %1