-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
54 lines (44 loc) · 1.65 KB
/
Copy pathDockerfile
File metadata and controls
54 lines (44 loc) · 1.65 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
# Stage 1: Build Microsandbox (Rust) - Only for target=microsandbox
FROM rust:1.75-slim-bookworm as builder
# Install build dependencies
RUN apt-get update && apt-get install -y \
git \
pkg-config \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
# Clone specific version of microsandbox with volume support
WORKDIR /usr/src
RUN git clone https://github.com/TJKlein/microsandbox.git
WORKDIR /usr/src/microsandbox
# Build release binary
RUN cargo build --release
# -----------------------------------------------------------------------------
# Base Python Stage (for both python-only and microsandbox)
# -----------------------------------------------------------------------------
FROM python:3.10-slim-bookworm as python-only
# Install system dependencies
RUN apt-get update && apt-get install -y \
curl \
git \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
# Additional dependencies
RUN pip install fastapi uvicorn httpx sse-starlette pydantic-monty
COPY . .
RUN pip install --no-cache-dir -e .
# Configure environment
ENV PYTHONPATH=/app
ENV SANDBOX_TYPE=opensandbox
# Default command
CMD ["python", "-m", "server.http_server"]
# -----------------------------------------------------------------------------
# Microsandbox Stage (includes rust binary)
# -----------------------------------------------------------------------------
FROM python-only as microsandbox
# Setup Microsandbox
COPY --from=builder /usr/src/microsandbox/target/release/msbserver /usr/local/bin/msbserver
ENV MICROSANDBOX_PATH=/usr/local/bin/msbserver
ENV SANDBOX_TYPE=microsandbox
CMD ["python", "-m", "server.http_server"]