Dockerize Kinode

(todo: use a different account other than my personal one as the namespace)
This commit is contained in:
Lyn 2024-04-04 17:42:56 +00:00
parent 1d8c6d5b59
commit c720e8d41c
No known key found for this signature in database
3 changed files with 77 additions and 0 deletions

23
.dockerignore Normal file
View File

@ -0,0 +1,23 @@
target/
wit/
**/target/
**/wit/
**/*.wasm
.vscode
.app-signing
.DS_Store
*.swp
*.swo
*.zip
/home
packages/**/pkg/*.wasm
packages/**/wit
*/**/node_modules
.env
kinode/src/bootstrapped_processes.rs
kinode/packages/**/wasi_snapshot_preview1.wasm
LICENSE
pull_request_template.md
README.md
Dockerfile

32
Dockerfile Normal file
View File

@ -0,0 +1,32 @@
# syntax=docker/dockerfile:1
FROM rust AS builder
COPY . /tmp/source
WORKDIR /tmp/source
RUN apt-get update
RUN apt-get install clang -y
RUN cargo install wasm-tools && \
rustup install nightly && \
rustup target add wasm32-wasi && \
rustup target add wasm32-wasi --toolchain nightly && \
cargo install cargo-wasi
RUN cargo +nightly build -p kinode --release
FROM debian:12-slim
RUN apt-get update
RUN apt-get install openssl -y
COPY --from=builder /tmp/source/target/release/kinode /bin/kinode
ENV LD_LIBRARY_PATH=/lib
ENV RUST_BACKTRACE=full
ENTRYPOINT [ "/bin/kinode" ]
CMD [ "/kinode" ]
EXPOSE 8080
EXPOSE 9000

View File

@ -134,3 +134,25 @@ Download and install an app:
m our@main:app_store:sys '{"Download": {"package": {"package_name": "<pkg>", "publisher_node": "<node>"}, "install_from": "<node>"}}' m our@main:app_store:sys '{"Download": {"package": {"package_name": "<pkg>", "publisher_node": "<node>"}, "install_from": "<node>"}}'
m our@main:app_store:sys '{"Install": {"package_name": "<pkg>", "publisher_node": "<node>"}}' m our@main:app_store:sys '{"Install": {"package_name": "<pkg>", "publisher_node": "<node>"}}'
``` ```
## Running as a Docker container
This image expects a volume mounted at `/kinode`. This volume may be empty or may contain another Kinode's data. It will be used as the home directory of your Kinode.
The image includes EXPOSE directives for TCP port `8080` and TCP port `9000`. Port `8080` is used for serving the Kinode web dashboard over HTTP, and it may be mapped to a different port on the host. Port `9000` is optional and is only required for a direct node.
If you are running a direct node, you must map port `9000` to the same port on the host and on your router. Otherwise, your Kinode will not be able to connect to the rest of the network as connection info is written to the chain, and this information is based on the view from inside the Docker container.
To build a local Docker image, run the following command in this project root.
```
docker build -t 0xlynett/kinode .
```
For example:
```
docker volume create kinode-volume
docker run -d -p 8080:8080 -it --name my-kinode \
--mount type=volume,source=kinode-volume,destination=/kinode \
0xlynett/kinode
```