melayumate-fastapi-ml / Dockerfile
Master
Change to 3 workers
58ff393
raw
history blame contribute delete
465 Bytes
FROM python:3.11-slim
RUN groupadd -r appgroup && \
useradd -r -g appgroup -d /home/appuser -m -s /bin/bash appuser
# 2. Switch to the new user
USER appuser
ENV PATH="/home/appuser/.local/bin:$PATH"
# 3. Set working directory
WORKDIR /home/appuser
COPY requirements.txt .
RUN pip install --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt
COPY . .
EXPOSE 7860
CMD ["hypercorn", "main:app", "--bind", "0.0.0.0:7860", "--workers", "3"]