diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..cc03353c --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +index +.gitignore +Dockerfile +docker-compose.yaml +README.md +LICENSE \ No newline at end of file diff --git a/.gitignore b/.gitignore index 83604101..93f10c3b 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,5 @@ example.db .DS_Store /client/examples/example-linux +docker/bitcoin-data +docker/indexer-data diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..22aa7ef5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM golang:1.22 + +WORKDIR /usr/src/app + +# pre-copy/cache go.mod for pre-downloading dependencies and only redownloading them in subsequent builds if they change +COPY go.mod go.sum ./ +RUN go mod download && go mod verify + +EXPOSE 26770 +COPY . . +RUN go build . +RUN chmod +x index +CMD ["./index", "serve", "live"] diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 00000000..4cb0b6ed --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,32 @@ +version: "3" +services: + bitcoind: + image: zquestz/bitcoin-cash-node + # specify additional command line arguments here + command: bitcoind + healthcheck: + test: ["CMD", "/entrypoint.sh", "bitcoin-cli", "getblockchaininfo"] + volumes: + - ./docker/bitcoin-data:/data + - ./docker/bitcoin.conf:/data/bitcoin.conf + networks: + - bitcoin + indexer: + build: . + ports: + - "${PORT}:26770" + volumes: + - ./docker/indexer-data:/usr/src/app/db/data + depends_on: + - bitcoind + networks: + - bitcoin + environment: + - 'NODE_HOST=[bitcoind]:8333' + - 'SERVER_HOST=0.0.0.0' + +networks: + bitcoin: + +volumes: + bitcoin-data: \ No newline at end of file diff --git a/docker/bitcoin.conf b/docker/bitcoin.conf new file mode 100644 index 00000000..7f54a5c7 --- /dev/null +++ b/docker/bitcoin.conf @@ -0,0 +1 @@ +txindex=1 \ No newline at end of file