-
Notifications
You must be signed in to change notification settings - Fork 60
Expand file tree
/
Copy pathDockerfile.alpine
More file actions
76 lines (59 loc) · 1.65 KB
/
Copy pathDockerfile.alpine
File metadata and controls
76 lines (59 loc) · 1.65 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Ultra-minimal Alpine-based QuDAG node
# Stage 1: Build in Alpine
FROM rust:1.75-alpine AS builder
# Install build dependencies
RUN apk add --no-cache \
musl-dev \
openssl-dev \
pkgconfig \
cmake \
make \
g++ \
git
# Set up static linking
ENV RUSTFLAGS="-C target-feature=-crt-static"
ENV OPENSSL_STATIC=1
ENV OPENSSL_LIB_DIR=/usr/lib
ENV OPENSSL_INCLUDE_DIR=/usr/include
WORKDIR /qudag
# Copy workspace files
COPY Cargo.toml Cargo.lock ./
COPY core/ ./core/
COPY cli-standalone/ ./cli-standalone/
COPY qudag/ ./qudag/
COPY benchmarks/ ./benchmarks/
COPY tools/ ./tools/
# Build statically linked binary
RUN cargo build --release --target x86_64-unknown-linux-musl --bin qudag --features "cli full"
# Stage 2: Minimal runtime
FROM alpine:3.19
# Install only essential runtime dependencies
RUN apk add --no-cache \
ca-certificates \
libgcc \
libstdc++ \
tini
# Create non-root user
RUN adduser -D -u 1000 -g 1000 -s /bin/sh qudag
# Copy binary from builder
COPY --from=builder /qudag/target/x86_64-unknown-linux-musl/release/qudag /usr/local/bin/qudag
# Create data directories
RUN mkdir -p /data /config /keys && \
chown -R qudag:qudag /data /config /keys
# Switch to non-root user
USER qudag
# Environment
ENV QUDAG_DATA_DIR=/data
ENV QUDAG_CONFIG_DIR=/config
ENV RUST_LOG=info
# Expose ports
EXPOSE 4001 8080 9090
# Use tini for proper signal handling
ENTRYPOINT ["/sbin/tini", "--"]
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD qudag status || exit 1
# Volumes
VOLUME ["/data", "/config", "/keys"]
# Default command
CMD ["qudag", "start", "--config", "/config/node.toml"]