-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
66 lines (52 loc) · 1.71 KB
/
Dockerfile
File metadata and controls
66 lines (52 loc) · 1.71 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
# Fula Gateway - S3-Compatible Storage Gateway
# Multi-stage build for minimal image size
# ============================================
# Stage 1: Build
# ============================================
FROM rust:1.85-bookworm AS builder
WORKDIR /app
# Install build 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 crates ./crates
# Build release binary with reduced parallelism for low-memory systems
# Set CARGO_BUILD_JOBS=1 to use single thread (less RAM, slower)
# Set CARGO_BUILD_JOBS=2 for balance between speed and memory
ENV CARGO_BUILD_JOBS=2
RUN cargo build --release --package fula-cli
# ============================================
# Stage 2: Runtime
# ============================================
FROM debian:bookworm-slim AS runtime
WORKDIR /app
# Install runtime dependencies (curl needed for health checks)
RUN apt-get update && apt-get install -y \
ca-certificates \
libssl3 \
curl \
&& rm -rf /var/lib/apt/lists/*
# Copy binary from builder
COPY --from=builder /app/target/release/fula-gateway /usr/local/bin/fula-gateway
# Create non-root user and data directory
RUN useradd -r -s /bin/false fula && \
mkdir -p /var/lib/fula-gateway && \
chown fula:fula /var/lib/fula-gateway
USER fula
# Expose port
EXPOSE 9000
# Health check
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
CMD curl -f http://localhost:9000/ || exit 1
# Set environment defaults
ENV FULA_HOST=0.0.0.0
ENV FULA_PORT=9000
ENV IPFS_API_URL=http://ipfs:5001
ENV CLUSTER_API_URL=http://cluster:9094
ENV RUST_LOG=info
# Run the gateway
ENTRYPOINT ["fula-gateway"]
CMD []