Spaces:
Running
Running
| # Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker | |
| # Dockerfile for Streamlit ABSA IndoBERT Web Application | |
| FROM python:3.9-slim | |
| # Create user for security | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| # Set working directory | |
| WORKDIR /app | |
| # Copy requirements and install dependencies | |
| COPY --chown=user ./requirements.txt requirements.txt | |
| RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
| # Download NLTK data yang diperlukan | |
| RUN python -c "import nltk; nltk.download('punkt', quiet=True); nltk.download('punkt_tab', quiet=True)" | |
| # Copy seluruh aplikasi | |
| COPY --chown=user . /app | |
| # Buat direktori yang diperlukan | |
| RUN mkdir -p chache_file/sessions assets/model assets/tokenizer .streamlit | |
| # Expose port 7860 (default Hugging Face Spaces) | |
| EXPOSE 7860 | |
| # Set environment variables untuk Streamlit | |
| ENV STREAMLIT_SERVER_PORT=7860 | |
| ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0 | |
| ENV STREAMLIT_SERVER_HEADLESS=true | |
| ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false | |
| # Run Streamlit app | |
| CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"] |