-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.app
More file actions
61 lines (54 loc) · 2.26 KB
/
Copy pathDockerfile.app
File metadata and controls
61 lines (54 loc) · 2.26 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
# Single self-contained cot image: builds the dashboard and serves it together
# with the collector API from one FastAPI/uvicorn process.
#
# docker run -d -p 127.0.0.1:31337:31337 --read-only --cap-drop ALL \
# --security-opt no-new-privileges:true --tmpfs /tmp:rw,noexec,nosuid,nodev,size=16m \
# --user "$(id -u):$(id -g)" -v ~/.cot:/data ghcr.io/cot-intelligence/cot
#
# Then open http://127.0.0.1:31337 and point your agent hooks at it.
# --- Stage 1: build the dashboard ---
FROM node:22-alpine AS web
WORKDIR /web
COPY package.json package-lock.json ./
RUN npm ci || npm install
COPY . .
RUN npm run build
# --- Stage 2: backend + bundled dashboard ---
FROM python:3.12-alpine
WORKDIR /app
ARG COT_UID=10001
ARG COT_GID=10001
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
HOME=/home/cot \
COT_DB_PATH=/data/cot.db \
COT_STATIC_DIR=/app/static
COPY backend/requirements.txt ./
RUN pip install --no-cache-dir --no-compile -r requirements.txt \
&& find /usr/local -type d -name __pycache__ -prune -exec rm -rf {} + \
&& find /usr/local/lib/python3.12 -type d \( -name test -o -name tests \) -prune -exec rm -rf {} + \
&& rm -rf \
/root/.cache \
/usr/local/bin/pip* \
/usr/local/lib/python3.12/ensurepip \
/usr/local/lib/python3.12/idlelib \
/usr/local/lib/python3.12/tkinter \
/usr/local/lib/python3.12/turtledemo \
/usr/local/lib/python3.12/site-packages/pip* \
/usr/local/lib/python3.12/site-packages/setuptools* \
/usr/local/lib/python3.12/site-packages/wheel* \
&& addgroup -g "${COT_GID}" -S cot \
&& adduser -u "${COT_UID}" -S -D -H -G cot -s /sbin/nologin cot \
&& install -d -o cot -g cot -m 0755 /app \
&& install -d -o cot -g cot -m 0750 /data /home/cot \
&& rm -f /bin/sh /bin/ash /bin/busybox
COPY --chown=cot:cot backend/app ./app
COPY --chown=cot:cot bridge ./bridge
COPY --chown=cot:cot --from=web /web/dist ./static
EXPOSE 31337
USER cot:cot
STOPSIGNAL SIGTERM
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD ["python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:31337/health', timeout=2).read()"]
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "31337"]