-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathDockerfile
80 lines (64 loc) · 2.11 KB
/
Dockerfile
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# Builder stage
FROM --platform=$BUILDPLATFORM ubuntu:24.04 AS builder
# Add platform-specific arguments
ARG TARGETPLATFORM
ARG BUILDPLATFORM
ARG TARGETARCH
ARG ENABLE_TDX
# Install build dependencies
RUN apt-get update && apt-get install -y \
build-essential \
pkg-config \
curl \
libssl-dev \
libssl3 \
ca-certificates \
&& if [ "$ENABLE_TDX" = "true" ]; then \
apt-get install -y libtss2-dev; \
fi \
&& rm -rf /var/lib/apt/lists/*
# Increase system limits for the build
RUN echo "* soft nofile 65535" >> /etc/security/limits.conf && \
echo "* hard nofile 65535" >> /etc/security/limits.conf && \
echo "* soft nproc 65535" >> /etc/security/limits.conf && \
echo "* hard nproc 65535" >> /etc/security/limits.conf
# Install Rust 1.84.0
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.84.0 \
&& . "$HOME/.cargo/env"
# Add cargo to PATH
ENV PATH="/root/.cargo/bin:${PATH}"
WORKDIR /usr/src/atoma-node
COPY . .
# Compile with increased limits
RUN ulimit -n 65535 && \
if [ "$ENABLE_TDX" = "true" ]; then \
RUST_LOG=${TRACE_LEVEL} cargo build --release --bin atoma-node --features tdx; \
else \
RUST_LOG=${TRACE_LEVEL} cargo build --release --bin atoma-node; \
fi
# Final stage
FROM ubuntu:24.04
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
libssl3 \
libsqlite3-0 \
&& if [ "$ENABLE_TDX" = "true" ]; then \
apt-get install -y \
libtss2-esys-3.0.2-0t64 \
libtss2-mu-4.0.1-0t64 \
libtss2-rc0t64 \
libtss2-sys1t64; \
fi \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Create necessary directories
RUN mkdir -p /app/data /app/logs
# Copy the built binary from builder stage
COPY --from=builder /usr/src/atoma-node/target/release/atoma-node /usr/local/bin/atoma-node
RUN chmod +x /usr/local/bin/atoma-node
# Copy and set up entrypoint script
COPY entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/entrypoint.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["/usr/local/bin/atoma-node", "--config-path", "/app/config.toml"]