Skip to content

Commit 3ec49f4

Browse files
author
cyberfly
committed
added local docker file
1 parent b5dc1db commit 3ec49f4

4 files changed

Lines changed: 63 additions & 11 deletions

File tree

.github/workflows/docker-build-push.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ jobs:
8282
cargo build \
8383
--release \
8484
--target ${{ matrix.target }} \
85-
--features jemalloc \
8685
-j$(nproc)
8786
8887
- name: Strip binary

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ RUN apt-get update && \
99
&& rm -rf /var/lib/apt/lists/*
1010

1111
WORKDIR /app
12-
1312
RUN mkdir -p /app/data/iroh/models
1413

1514
ARG TARGETARCH
@@ -28,8 +27,9 @@ ENV KMP_AFFINITY=disabled
2827
ENV GOMP_CPU_AFFINITY=0
2928

3029
ENV MALLOC_ARENA_MAX=1
30+
ENV LD_PRELOAD=
31+
3132
ENV SLED_CACHE_MB=256
3233

3334
EXPOSE 31001 31002 31003 31006
34-
3535
ENTRYPOINT ["/app/docker-entrypoint.sh"]

Dockerfile.local

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
FROM ubuntu:22.04
2+
3+
# Install build dependencies
4+
RUN apt-get update && apt-get install -y \
5+
build-essential \
6+
curl \
7+
pkg-config \
8+
libssl-dev \
9+
cmake \
10+
clang \
11+
ca-certificates \
12+
libgomp1 \
13+
libstdc++6 \
14+
&& rm -rf /var/lib/apt/lists/*
15+
16+
# Install Rust
17+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
18+
ENV PATH="/root/.cargo/bin:${PATH}"
19+
20+
WORKDIR /build
21+
22+
# Copy source code
23+
COPY Cargo.toml ./
24+
COPY src ./src
25+
COPY schema.graphql ./
26+
27+
# Build release binary
28+
RUN cargo build --release
29+
30+
# Create runtime directory
31+
RUN mkdir -p /app/data/iroh/models
32+
33+
# Copy binary to app directory
34+
RUN cp target/release/cyberfly-rust-node /app/cyberfly-rust-node && \
35+
cp schema.graphql /app/schema.graphql && \
36+
chmod +x /app/cyberfly-rust-node
37+
38+
WORKDIR /app
39+
40+
# Create entrypoint script
41+
RUN printf '#!/bin/sh\nset -e\nmkdir -p /app/data/iroh/models\nexec /app/cyberfly-rust-node "$@"\n' > /app/docker-entrypoint.sh && \
42+
chmod +x /app/docker-entrypoint.sh
43+
44+
# MNN configuration
45+
ENV MNN_BACKEND=cpu
46+
ENV MNN_DISABLE_GPU=1
47+
48+
# OpenMP configuration
49+
ENV OMP_NUM_THREADS=1
50+
ENV OMP_WAIT_POLICY=PASSIVE
51+
ENV KMP_AFFINITY=disabled
52+
ENV GOMP_CPU_AFFINITY=0
53+
54+
# Memory configuration
55+
ENV MALLOC_ARENA_MAX=1
56+
ENV LD_PRELOAD=
57+
ENV SLED_CACHE_MB=256
58+
59+
EXPOSE 31001 31002 31003 31006
60+
61+
ENTRYPOINT ["/app/docker-entrypoint.sh"]

src/main.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ mod storage;
1818
mod sync; // Data synchronization with CRDT
1919
mod inference; // AI inference execution
2020

21-
// Use jemalloc on Linux for better multi-threaded allocation performance
22-
#[cfg(all(target_os = "linux", feature = "jemalloc"))]
23-
#[global_allocator]
24-
static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
25-
2621
use anyhow::Result;
2722
use axum::{routing::get, Router};
2823
use iroh::discovery::pkarr::dht::DhtDiscovery;
@@ -92,9 +87,6 @@ async fn main() -> Result<()> {
9287
)
9388
.init();
9489

95-
#[cfg(all(target_os = "linux", feature = "jemalloc"))]
96-
tracing::info!("Using jemalloc allocator for improved performance");
97-
9890
tracing::info!("Starting decentralized database node...");
9991

10092
// Fetch and set node region on startup (same as JS implementation)

0 commit comments

Comments
 (0)