Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose websocket electrs API using websocat #6

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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
19 changes: 15 additions & 4 deletions a808b51d0d9301fa82390b985c57551966001f9b/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,33 @@
# Electrs build stage
FROM rust:latest AS builder

ARG COMMIT=253040e346664976c12e6c214ee2858a4dad2e06

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

COPY install-websocat.sh /install-websocat.sh
RUN chmod +x /install-websocat.sh && /install-websocat.sh

# 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

STOPSIGNAL SIGINT

ENTRYPOINT ["/build/electrs"]
ENTRYPOINT ["bash", "/entrypoint.sh"]
13 changes: 11 additions & 2 deletions a808b51d0d9301fa82390b985c57551966001f9b/Dockerfile.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,21 @@ 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

COPY install-websocat.sh /install-websocat.sh
louisinger marked this conversation as resolved.
Show resolved Hide resolved
RUN chmod +x /install-websocat.sh && /install-websocat.sh

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

STOPSIGNAL SIGINT

ENTRYPOINT ["/build/electrs"]
ENTRYPOINT ["bash", "/entrypoint.sh"]
5 changes: 5 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
set -m
electrs&
websocat -b ws-l:127.0.0.1:1234 tcp:127.0.0.1:50001&
louisinger marked this conversation as resolved.
Show resolved Hide resolved
fg %1
4 changes: 4 additions & 0 deletions install-websocat.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
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