-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContainerfile
More file actions
59 lines (43 loc) · 1.33 KB
/
Copy pathContainerfile
File metadata and controls
59 lines (43 loc) · 1.33 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
# Cerberus Containerfile (Compatible with Podman & Docker)
# Multi-stage build for smaller final image
# Stage 1: Build stage
FROM python:3.13-slim AS builder
# Install build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
cmake \
g++ \
gcc \
git \
make \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /build
# Copy project files
COPY pyproject.toml CMakeLists.txt ./
COPY cerberus ./cerberus
COPY cpp ./cpp
# Install Python build dependencies
RUN pip install --no-cache-dir scikit-build-core pybind11
# Build the wheel (not editable mode)
RUN pip wheel --no-cache-dir --no-build-isolation --wheel-dir /wheels .
# Stage 2: Runtime stage
FROM python:3.13-slim
# Install runtime dependencies only
RUN apt-get update && apt-get install -y --no-install-recommends \
libstdc++6 \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user for security
RUN useradd -m -u 1000 cerberus
# Set working directory
WORKDIR /app
# Copy and install the wheel from builder stage
COPY --from=builder /wheels/*.whl /tmp/
RUN pip install --no-cache-dir /tmp/*.whl && rm -rf /tmp/*.whl
# Change ownership to non-root user
RUN chown -R cerberus:cerberus /app
# Switch to non-root user
USER cerberus
# Set entrypoint
ENTRYPOINT ["cerberus"]
# Default command (can be overridden)
CMD []