-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContainerfile
More file actions
79 lines (60 loc) · 2.18 KB
/
Containerfile
File metadata and controls
79 lines (60 loc) · 2.18 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
77
78
79
# Build stage
FROM rust:1.78-slim as builder
# Install build dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
build-essential \
libc6-dev \
&& rm -rf /var/lib/apt/lists/*
# Set the working directory
WORKDIR /app
# Copy the Cargo.toml and Cargo.lock
COPY Cargo.toml Cargo.lock ./
# Copy the source code
COPY src ./src
# Build the application in release mode
RUN cargo build --release
# Runtime stage
FROM debian:bookworm-slim
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Create a non-root user
RUN useradd -m -s /bin/bash ipc-benchmark
# Set up shared memory with proper permissions
RUN mkdir -p /dev/shm && \
chmod 1777 /dev/shm
# Copy the binary from the builder stage
COPY --from=builder /app/target/release/ipc-benchmark /usr/local/bin/ipc-benchmark
# Make the binary executable
RUN chmod +x /usr/local/bin/ipc-benchmark
# Create directories for output
RUN mkdir -p /app/output && \
chown ipc-benchmark:ipc-benchmark /app/output
# Switch to non-root user
USER ipc-benchmark
# Set the working directory
WORKDIR /app
# Set environment variables
ENV RUST_LOG=info
ENV IPC_BENCHMARK_TEMP_DIR=/tmp
ENV IPC_BENCHMARK_OUTPUT_DIR=/app/output
# Expose no ports by default (IPC is local)
# TCP tests will use ephemeral ports
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD ipc-benchmark --help || exit 1
# Default command
ENTRYPOINT ["ipc-benchmark"]
CMD ["--help"]
# Labels for better container management
LABEL maintainer="IPC Benchmark Contributors"
LABEL version="0.1.0"
LABEL description="IPC Benchmark Suite - A comprehensive tool for measuring IPC performance"
LABEL org.opencontainers.image.title="IPC Benchmark"
LABEL org.opencontainers.image.description="A comprehensive interprocess communication benchmark suite"
LABEL org.opencontainers.image.authors="IPC Benchmark Contributors"
LABEL org.opencontainers.image.source="https://github.com/your-org/ipc-benchmark"
LABEL org.opencontainers.image.documentation="https://github.com/your-org/ipc-benchmark/blob/main/README.md"
LABEL org.opencontainers.image.licenses="Apache-2.0"