peace4ever's picture
Update Dockerfile
9baefed verified
raw
history blame
1.26 kB
# 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 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 Streamlit default port
EXPOSE 8501
# Command to run the Streamlit app
CMD ["streamlit", "run", "app.py", "--server.port", "8501", "--server.address", "0.0.0.0"]