Bikas0's picture
update for timeout
6cbb46c verified
# # # # Use the official Python image from the Docker Hub
# # # FROM python:3.10.0-slim-buster
# # # # Set the working directory in the container
# # # WORKDIR /app
# # # # Copy the current directory contents into the container at /app
# # # COPY . /app
# # # # Upgrade pip to the latest version
# # # RUN pip install --upgrade pip
# # # # Install any needed packages specified in requirements.txt
# # # RUN pip install --no-cache-dir -r requirements.txt
# # # # Create directories for NLTK and Hugging Face cache data
# # # RUN mkdir -p /app/nltk_data /app/.cache/huggingface /app/.huggingface_cache
# # # # Download NLTK data (punkt and wordnet)
# # # RUN python -m nltk.downloader -d /app/nltk_data punkt wordnet
# # # # Set environment variables
# # # ENV NLTK_DATA=/app/nltk_data
# # # ENV HF_HOME=/app/.huggingface_cache
# # # ENV TRANSFORMERS_CACHE=/app/.huggingface_cache
# # # # Change ownership of directories to the non-root user
# # # RUN chown -R nobody:nogroup /app/nltk_data /app/.huggingface_cache /app
# # # # Switch to a non-root user
# # # USER nobody
# # # # Make port 7860 available to the world outside this container
# # # EXPOSE 7860
# # # # Command to run the application
# # # CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]
# # Use the official Python image from the Docker Hub
# FROM python:3.10.0-slim-buster
# # Set the working directory in the container
# WORKDIR /app
# # Copy the current directory contents into the container at /app
# COPY . /app
# # Upgrade pip to the latest version
# RUN pip install --upgrade pip
# # Install build essentials and gfortran
# RUN apt-get update && apt-get install -y \
# build-essential \
# gfortran \
# && rm -rf /var/lib/apt/lists/*
# # Install any needed packages specified in requirements.txt
# RUN pip install --no-cache-dir -r requirements.txt
# # Install NumPy version 1.21.0
# RUN pip install --no-cache-dir numpy==1.21.0
# # Create directories for NLTK and Hugging Face cache data
# RUN mkdir -p /app/nltk_data /app/.cache/huggingface /app/.huggingface_cache
# # Download NLTK data (punkt and wordnet)
# RUN python -m nltk.downloader -d /app/nltk_data punkt wordnet
# # Set environment variables
# ENV NLTK_DATA=/app/nltk_data
# ENV HF_HOME=/app/.huggingface_cache
# ENV TRANSFORMERS_CACHE=/app/.huggingface_cache
# # Change ownership of directories to the non-root user
# RUN chown -R nobody:nogroup /app/nltk_data /app/.huggingface_cache /app
# # Switch to a non-root user
# USER nobody
# # Make port 7860 available to the world outside this container
# EXPOSE 7860
# # Command to run the application
# CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]
# Use the official Python image from the Docker Hub
FROM python:3.10.0-slim-buster
# Set the working directory in the container
WORKDIR /app
# Copy the current directory contents into the container at /app
COPY . /app
# Upgrade pip to the latest version
RUN pip install --upgrade pip
# Install build essentials and gfortran
RUN apt-get update && apt-get install -y \
build-essential \
gfortran \
&& rm -rf /var/lib/apt/lists/*
# Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Install NumPy version 1.21.0
RUN pip install --no-cache-dir numpy==1.21.0
# Create directories for NLTK and Hugging Face cache data
RUN mkdir -p /app/nltk_data /app/.cache/huggingface /app/.huggingface_cache
# Download NLTK data (punkt and wordnet)
RUN python -m nltk.downloader -d /app/nltk_data punkt wordnet
# Set environment variables
ENV NLTK_DATA=/app/nltk_data
ENV HF_HOME=/app/.huggingface_cache
ENV TRANSFORMERS_CACHE=/app/.huggingface_cache
# Change ownership of directories to the non-root user
RUN chown -R nobody:nogroup /app/nltk_data /app/.huggingface_cache /app
# Switch to a non-root user
USER nobody
# Make port 7860 available to the world outside this container
EXPOSE 7860
# Command to run the application
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "2", "--timeout", "120", "app:app"]