diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..94143827 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..b57becdc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +FROM debian:bookworm-slim AS base + +RUN apt update -qy +RUN apt install -qy librocksdb-dev + +FROM base as build + +RUN apt install -qy git cargo clang cmake + +WORKDIR /build +COPY . . + +RUN cargo build --release --bin electrs + +FROM base as deploy + +COPY --from=build /build/target/release/electrs /bin/electrs + +EXPOSE 50001 + +ENTRYPOINT ["/bin/electrs"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..f6fe6dc6 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,24 @@ +version: '3.9' +services: + + mempool-electrs: + build: + context: . + dockerfile: Dockerfile + restart: on-failure + + ports: + - 50001:50001 + + entrypoint: + /bin/electrs + command: | + --address-search + --cookie mempool:mempool + --db-dir /electrs + --cors '*' + volumes: + - 'electrs_data:/electrs' + +volumes: + electrs_data: \ No newline at end of file diff --git a/electrs_data/.gitkeep b/electrs_data/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/src/daemon.rs b/src/daemon.rs index aadef56a..e99523dc 100644 --- a/src/daemon.rs +++ b/src/daemon.rs @@ -184,7 +184,7 @@ impl Connection { .chain_err(|| { ErrorKind::Connection("disconnected from daemon while receiving".to_owned()) })? - .chain_err(|| "failed to read status")?; + .chain_err(|| ErrorKind::Connection("failed to read status".to_owned()))?; let mut headers = HashMap::new(); for line in iter { let line = line.chain_err(|| ErrorKind::Connection("failed to read".to_owned()))?;