agent-iot / Dockerfile
ASown's picture
Consolidate project history under ASown
f368481
Raw History Blame Contribute Delete
1.39 kB
# Agent harness — deploy image.
# Uses a plain Python base and installs Chromium + its OS deps via Playwright, so
# the CNC simulator tool (headless browser) works on a server.
FROM python:3.11-slim
ENV PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
CNC_HEADLESS=1 \
PORT=8080 \
HOME=/app \
PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
WORKDIR /app
# Install Python deps first (better layer caching), then the matching Chromium
# build + its system libraries (--with-deps runs apt-get for us). Browsers go to
# a fixed, world-readable path so the app finds them even if the platform (e.g.
# Hugging Face Spaces) runs the container as a non-root user.
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt \
&& python -m playwright install --with-deps chromium \
&& chmod -R a+rx /ms-playwright \
&& apt-get update && apt-get install -y --no-install-recommends curl \
&& rm -rf /var/lib/apt/lists/*
COPY . .
# Writable dirs for the modules' generated output + uploads (any runtime user).
RUN mkdir -p modules/cnc_websim/cncwebsim/agent_outputs var/uploads \
&& chmod -R a+rwx modules var
EXPOSE 8080
# Single worker on purpose: the app serializes tool runs behind one lock and one
# shared browser; multiple workers would each spawn their own Chromium.
CMD ["sh", "-c", "uvicorn harness.webapp:app --host 0.0.0.0 --port ${PORT:-8080} --workers 1"]