email-classification / Dockerfile
sajadup
Merge remote files and add my email app
591f049
raw
history blame contribute delete
716 Bytes
FROM python:3.9
# 1. Create a non-root user
RUN useradd -m -u 1000 user
USER user
# 2. Set environment variables to ensure Python finds installed packages
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
PYTHONPATH=/home/user/app
WORKDIR /app
# 3. Upgrade pip first (important for newer packages)
RUN pip install --no-cache-dir --upgrade pip
# 4. Copy requirements and install
COPY --chown=user requirements.txt .
# Adding --user ensures packages go to the path we set above
RUN pip install --no-cache-dir --user -r requirements.txt
# 5. Copy the rest of your app
COPY --chown=user . .
# 6. Run the app
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]