-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.sim
More file actions
67 lines (53 loc) · 2.21 KB
/
Dockerfile.sim
File metadata and controls
67 lines (53 loc) · 2.21 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
# Simulation Dockerfile
#
# Builds a privileged container for running SPACE simulations (NVRAM, NVMe-oF, etc.)
# Requires Linux host with hugepages support for NVMe-oF simulation.
#
# Build: docker build -t space-sim:latest -f Dockerfile.sim .
# Run: docker run --privileged -e SIM_MODULES=nvram,nvmeof space-sim:latest
# ============================================================================
# Builder Stage: Compile simulation crates
# ============================================================================
FROM rust:1.83 as builder
WORKDIR /usr/src/space
# Copy workspace manifests
COPY Cargo.toml Cargo.lock ./
COPY crates/ ./crates/
COPY vendor/ ./vendor/
# Build simulation crates and their binaries
# Build everything first, then we'll copy selectively
RUN cargo build --release -p sim-nvram -p sim-nvmeof -p sim-other
# ============================================================================
# Runtime Stage: Ubuntu with simulation tools
# ============================================================================
FROM ubuntu:24.04
# Install runtime dependencies + simulation tools
RUN apt-get update && apt-get install -y \
ca-certificates \
libssl3 \
numactl \
pciutils \
iproute2 \
procps \
&& rm -rf /var/lib/apt/lists/*
# Create directories for simulation modules
RUN mkdir -p /sim/nvram /sim/nvmeof /sim/other /data
# Copy simulation binaries
COPY --from=builder /usr/src/space/target/release/sim-nvmeof /usr/local/bin/
# Copy entrypoint script (created in next step)
COPY scripts/sim-entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
# Create non-root user (but we'll run as root for SPDK hugepages access)
# Production note: Use capabilities instead of --privileged in real deployments
RUN useradd -m -u 1000 space
WORKDIR /data
# Set default environment
ENV SIM_MODULES=nvram
ENV RUST_LOG=info
# Entrypoint handles selective module loading
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
# Metadata
LABEL org.opencontainers.image.title="SPACE Simulation" \
org.opencontainers.image.description="Dev/Test simulation container for SPACE" \
org.opencontainers.image.vendor="Adaptive Storage" \
org.opencontainers.image.licenses="Apache-2.0"