31 lines
960 B
Docker
31 lines
960 B
Docker
FROM rust:slim AS builder
|
|
|
|
RUN apt-get update && apt-get install -y \
|
|
pkg-config libssl-dev g++ \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
COPY Cargo.toml Cargo.lock ./
|
|
COPY hub/Cargo.toml hub/Cargo.toml
|
|
COPY node/Cargo.toml node/Cargo.toml
|
|
COPY native-node/Cargo.toml native-node/Cargo.toml
|
|
|
|
# Tyhjät src-tiedostot riippuvuuksien esikääntämistä varten
|
|
RUN mkdir -p hub/src node/src native-node/src \
|
|
&& echo "fn main(){}" > hub/src/main.rs \
|
|
&& echo "" > node/src/lib.rs \
|
|
&& echo "fn main(){}" > native-node/src/main.rs \
|
|
&& cargo build --release -p native-node 2>/dev/null || true
|
|
|
|
COPY native-node/src native-node/src
|
|
RUN cargo build --release -p native-node
|
|
|
|
FROM debian:bookworm-slim
|
|
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
|
|
COPY --from=builder /app/target/release/native-node /usr/local/bin/native-node
|
|
|
|
ENV HUB_URL=ws://hub:3000/ws
|
|
ENV ALLOCATED_GB=4
|
|
|
|
CMD ["native-node"]
|