-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathDockerfile.local
More file actions
53 lines (38 loc) · 1.29 KB
/
Dockerfile.local
File metadata and controls
53 lines (38 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# syntax=docker/dockerfile:1
# Stage 1: Builder
FROM rust:bookworm AS builder
# Install dependencies needed for building
# clang-sys requires libclang - libclang-dev provides libclang-14.so in /usr/lib/x86_64-linux-gnu/
RUN apt-get update && \
apt-get install -y cmake clang libclang-dev protobuf-compiler && \
rm -rf /var/lib/apt/lists/*
ENV LIBCLANG_PATH=/usr/lib/x86_64-linux-gnu
# Add wasm target for runtime compilation
RUN rustup target add wasm32-unknown-unknown
WORKDIR /app
# Copy the entire project
COPY . .
# Build the release binary
# We use --locked to respect the Cargo.lock file
RUN cargo build --release -p quantus-node
# Stage 2: Runtime
FROM ubuntu:24.04
# Install runtime dependencies
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ca-certificates \
curl \
libterm-readline-perl-perl \
net-tools \
&& rm -rf /var/lib/apt/lists/*
# Copy the binary from the builder stage
COPY --from=builder /app/target/release/quantus-node /usr/local/bin/
# Expose P2P and public WS/RPC ports
EXPOSE 30333 9944
# Run as unprivileged user
RUN useradd --system --uid 10001 quantus \
&& mkdir -p /var/lib/quantus \
&& chown -R quantus:quantus /var/lib/quantus
USER 10001:10001
# Start the node
ENTRYPOINT ["quantus-node"]