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

chore(docker): init #504

Closed
wants to merge 3 commits into from
Closed
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
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.git
.github
.gitignore

docker
target
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,20 @@ wRPC

</details>

### Running on Docker

Note: currently, only linux-gnu is supported, hence image size is large.

* using docker-compose
```bash
docker-compose up
```

* using docker
```bash
docker build -t kaspa/kaspad -f docker/Dockerfile .
docker run kaspa/kaspad kaspad [ARGS_HERE]
```

<details>

Expand Down
35 changes: 35 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: "3.6"

services:
kaspad:
# allow to automatically build image if not exists upstream
build:
context: .
dockerfile: ./docker/Dockerfile
image: docker.io/kaspa/kaspad
ports:
# P2P
- 16111:16111
# mainnet RPC
- 16110:16110
# testnet RPC
- 16210:16210
# mainnet borshch RPC
- 17110:17110
# testnet borshch RPC
- 17210:17210
# mainnet json RPC
- 18110:18110
# testnet json RPC
- 18210:18210

command: "./kaspad --utxoindex --appdir /app/data"
# testnet command
# command: './kaspad --testnet --netsuffix=11 --utxoindex --appdir /app/data'
volumes:
- type: volume
source: data
target: /app/data

volumes:
data:
34 changes: 34 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM rust:1.79.0-bookworm AS builder

RUN apt-get update
RUN apt-get install -y build-essential libssl-dev pkg-config
RUN apt-get install -y protobuf-compiler libprotobuf-dev
RUN apt-get install -y clang-format clang-tidy \
clang-tools clang clangd libc++-dev \
libc++1 libc++abi-dev libc++abi1 \
libclang-dev libclang1 liblldb-dev \
libllvm-ocaml-dev libomp-dev libomp5 \
lld lldb llvm-dev llvm-runtime \
llvm python3-clang

WORKDIR /app

COPY . .

RUN rustup target add x86_64-unknown-linux-gnu

RUN cargo build --release --target x86_64-unknown-linux-gnu --bin kaspad --bin kaspa-wallet

FROM debian:bookworm

RUN apt-get update

# fix Reqwest error: unable to get local issuer certificate
RUN apt-get install -y ca-certificates

WORKDIR app

COPY --from=builder /app/target/x86_64-unknown-linux-gnu/release/kaspad .
COPY --from=builder /app/target/x86_64-unknown-linux-gnu/release/kaspa-wallet .

CMD ["./kaspad"]