| FROM python:3.10-slim |
|
|
| WORKDIR /app |
|
|
| COPY . /app |
|
|
| |
| RUN pip install --no-cache-dir -r requirements_product.txt |
|
|
| |
| RUN useradd -m -u 1000 appuser |
|
|
| |
| RUN mkdir -p /data/hf_cache /data/streamlit_config && \ |
| chown -R appuser:appuser /data/hf_cache /data/streamlit_config /app && \ |
| chmod -R 775 /data/hf_cache /data/streamlit_config /app |
|
|
| |
| RUN rm -rf /data/hf_cache/huggingface/hub/* |
|
|
| |
| ENV HF_HOME=/data/hf_cache |
| ENV TRANSFORMERS_CACHE=/data/hf_cache |
| ENV STREAMLIT_HOME=/data/streamlit_config |
| ENV STREAMLIT_CONFIG_DIR=/data/streamlit_config |
|
|
| |
| USER appuser |
|
|
| |
| EXPOSE 7860 |
| EXPOSE 8000 |
|
|
| CMD ["bash", "-c", "uvicorn server:app --host 0.0.0.0 --port 8000 & streamlit run app.py --server.port 7860 --server.address 0.0.0.0"] |