# FROM python:3.9-slim # WORKDIR /code # # Copy requirements first to leverage caching # COPY ./requirements.txt /code/requirements.txt # # Create the cache directory with the appropriate permissions # RUN mkdir -p /code/.cache && chmod -R 777 /code/.cache # # Set the environment variable for the transformers cache # ENV TRANSFORMERS_CACHE=/code/.cache # # Install dependencies # RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt # # Copy application code # COPY app.py . # # Expose the application port # EXPOSE 7860 # # Ensure the entrypoint is correct # CMD ["python", "app.py"] FROM python:3.9-slim WORKDIR /code COPY ./requirements.txt /code/requirements.txt RUN mkdir -p /code/.cache && chmod -R 777 /code/.cache ENV TRANSFORMERS_CACHE=/code/.cache RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt COPY app.py . EXPOSE 8501 CMD ["streamlit", "run", "app.py", "--server.port", "8501", "--server.address", "0.0.0.0"]