From c222efb9d6406e52cd6d736ec71ad2285e932eb9 Mon Sep 17 00:00:00 2001 From: Felipe Knorr Kuhn Date: Sun, 23 Jul 2023 18:07:39 +0900 Subject: [PATCH 1/2] Initial Docker support --- Dockerfile | 21 +++++++++++++++++++++ docker-compose.yml | 24 ++++++++++++++++++++++++ electrs_data/.gitkeep | 0 3 files changed, 45 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 electrs_data/.gitkeep diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..b57becdcf --- /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 000000000..f6fe6dc6f --- /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 000000000..e69de29bb From ee0e16edf7d9a8474be034a6024cd7abc2fdc7ae Mon Sep 17 00:00:00 2001 From: Felipe Knorr Kuhn Date: Sun, 23 Jul 2023 18:27:06 +0900 Subject: [PATCH 2/2] Add dockerignore --- .dockerignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..94143827e --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +Dockerfile