forked from SO4-Markets/so4-oracle
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
54 lines (41 loc) · 1.3 KB
/
Copy pathDockerfile
File metadata and controls
54 lines (41 loc) · 1.3 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
# Build stage
# Must stay >= the highest MSRV in Cargo.lock — stellar-rpc-client 27 requires
# Rust 1.93, jsonrpsee 0.26 requires 1.85, axum 0.8 requires 1.80.
FROM rust:1.95-slim AS builder
WORKDIR /app
# Install dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy workspace files
COPY Cargo.toml Cargo.lock ./
COPY shared/config ./shared/config
COPY oracle ./oracle
# config/tokens.json is embedded via include_str! at compile time and must
# be present in the builder stage before cargo build runs (#502).
COPY config ./config
# Build the binary
RUN cargo build --release --locked --bin oracle
# Runtime stage
FROM debian:bookworm-slim
WORKDIR /app
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
curl \
&& rm -rf /var/lib/apt/lists/*
# Copy the binary from builder
COPY --from=builder /app/target/release/oracle /app/oracle
# Copy configuration files
COPY config/tokens.json /app/config/tokens.json
# Create non-root user
RUN useradd -r -s /bin/false oracle
USER oracle
# Expose port
EXPOSE 8080
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8080/health || exit 1
# Run the binary
CMD ["/app/oracle"]