vfrplan-agent / Dockerfile
crodri's picture
changed into docker
4d97285
Raw History Blame Contribute Delete
1.99 kB
# vfrplan agent — Docker Space.
#
# Replaces the earlier Gradio SDK version of this same Space. Switching SDK is
# a README.md metadata change (sdk: gradio -> sdk: docker) plus this file; see
# DEPLOY.md §1 before the first push, because leaving the old metadata in place
# makes the Space ignore this Dockerfile entirely.
FROM python:3.12-slim
# git/git-lfs/curl/wget/procps are not used by the app. They are what Hugging
# Face's Dev Mode layer needs (VS Code in the browser + SSH); without them a
# Space with Dev Mode enabled fails to build with a bare "git: not found",
# which is exactly how the vfrplan-mcp Space failed on its first deploy.
RUN apt-get update && apt-get install -y --no-install-recommends \
git git-lfs curl wget procps \
&& rm -rf /var/lib/apt/lists/*
# uid 1000 and /app: both are Hugging Face conventions. Dev Mode expects the
# application to live in /app owned by uid 1000 so it can edit files in the
# running container.
RUN useradd --create-home --uid 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
WORKDIR $HOME/app
COPY --chown=user requirements.txt ./
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt
COPY --chown=user PROMPT.md ./
COPY --chown=user app ./app
# 7860 is the Spaces default and matches app_port in README.md. Change one and
# you must change the other.
EXPOSE 7860
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD python -c "import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://127.0.0.1:7860/health', timeout=4).status==200 else 1)"
# Single worker on purpose: the runtime config (endpoint, model, token set
# through the settings panel) lives in this process's memory, so a second
# worker would answer some requests with stale settings.
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]