Categorization / Dockerfile
kabeerahmad's picture
Update Dockerfile
5ce0015 verified
Raw History Blame Contribute Delete
865 Bytes
# ─── Dockerfile ─────────────────────────────────
FROM python:3.10-slim
# 1) Install system deps + git for pip/git installs
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
git \
libgl1-mesa-glx \
libglib2.0-0 \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# 2) Workdir & copy requirements
WORKDIR /app
COPY requirements.txt .
# 3) Install Python deps **as root** so that uvicorn ends up in /usr/local/bin
RUN pip install --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt
# 4) Create non-root user and switch
RUN useradd --create-home appuser
USER appuser
# 5) Copy your code (owned by appuser)
COPY --chown=appuser . .
# 6) Expose & launch
EXPOSE 8000
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]