Spaces:
Sleeping
Sleeping
# Base image | |
FROM python:3.10-slim | |
# Create app directory | |
WORKDIR /home/appuser/app | |
# Set environment variables | |
ENV PATH="/home/appuser/.local/bin:$PATH" | |
ENV PYTHONDONTWRITEBYTECODE=1 | |
ENV PYTHONUNBUFFERED=1 | |
# Install dependencies | |
COPY requirement.txt . | |
RUN pip install --upgrade pip \ | |
&& pip install --user -r requirement.txt | |
# Add a non-root user | |
RUN adduser --disabled-password --gecos "" appuser | |
USER appuser | |
# Copy code | |
COPY --chown=appuser:appuser . . | |
# Expose ports | |
EXPOSE 8000 | |
EXPOSE 8501 | |
# Start FastAPI then Streamlit | |
CMD uvicorn streamlit_app.main_api:app --host 0.0.0.0 --port 8000 & \ | |
streamlit run streamlit_app/app.py --server.port 8501 | |