-
-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathDockerfile
More file actions
71 lines (51 loc) · 2.32 KB
/
Copy pathDockerfile
File metadata and controls
71 lines (51 loc) · 2.32 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
# ── Stage 1: Build the SvelteKit frontend ──────────────────
FROM --platform=$BUILDPLATFORM node:22-slim AS frontend-builder
WORKDIR /build/frontend
COPY cptr/frontend/package.json cptr/frontend/package-lock.json ./
RUN npm ci
COPY cptr/frontend/ ./
RUN npm run build
# ── Stage 2: Install Python dependencies & build wheel ─────
FROM --platform=$BUILDPLATFORM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS backend-builder
WORKDIR /build
COPY pyproject.toml uv.lock LICENSE README.md CHANGELOG.md ./
COPY cptr/ cptr/
# Drop the pre-built frontend into the package tree
COPY --from=frontend-builder /build/frontend/build cptr/frontend/build
# Build the wheel (includes frontend build as an artifact via hatch)
RUN uv build --wheel --out-dir /dist
# ── Stage 3: Shared runtime ────────────────────────────────
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS runtime
LABEL org.opencontainers.image.source="https://github.com/open-webui/computer"
LABEL org.opencontainers.image.description="Open WebUI Computer"
# Runtime deps shared by default and browser images.
RUN apt-get update && \
apt-get install -y --no-install-recommends gh git tini && \
rm -rf /var/lib/apt/lists/*
# Create non-root user and writable data directory
RUN useradd --create-home --shell /bin/bash cptr && \
mkdir -p /data && \
chown -R cptr:cptr /data
USER cptr
WORKDIR /home/cptr
# Install the wheel into an isolated venv
COPY --chown=cptr:cptr --from=backend-builder /dist/*.whl /tmp/
RUN uv venv /home/cptr/.venv && \
set -- /tmp/*.whl && \
uv pip install --python /home/cptr/.venv/bin/python "$1[all]" && \
rm /tmp/*.whl
ENV PATH="/home/cptr/.venv/bin:$PATH"
ENV CPTR_DATA_DIR="/data"
EXPOSE 8000
VOLUME ["/data"]
ENTRYPOINT ["tini", "--"]
CMD ["cptr", "run", "--host", "0.0.0.0", "--port", "8000", "--headless"]
# ── Browser image: Chromium for agent browser automation ───
FROM runtime AS browser
USER root
RUN apt-get update && \
apt-get install -y --no-install-recommends chromium && \
rm -rf /var/lib/apt/lists/*
USER cptr
# ── Default image ──────────────────────────────────────────
FROM runtime AS default