iluasdfiuasfd/Abstract-Text-Summarizer
0
1# # # # Use the official Python image from the Docker Hub
2# # # FROM python:3.10.0-slim-buster
3
4# # # # Set the working directory in the container
5# # # WORKDIR /app
6
7# # # # Copy the current directory contents into the container at /app
8# # # COPY . /app
9
10# # # # Upgrade pip to the latest version
11# # # RUN pip install --upgrade pip
12
13# # # # Install any needed packages specified in requirements.txt
14# # # RUN pip install --no-cache-dir -r requirements.txt
15
16# # # # Create directories for NLTK and Hugging Face cache data
17# # # RUN mkdir -p /app/nltk_data /app/.cache/huggingface /app/.huggingface_cache
18
19# # # # Download NLTK data (punkt and wordnet)
20# # # RUN python -m nltk.downloader -d /app/nltk_data punkt wordnet
21
22# # # # Set environment variables
23# # # ENV NLTK_DATA=/app/nltk_data
24# # # ENV HF_HOME=/app/.huggingface_cache
25# # # ENV TRANSFORMERS_CACHE=/app/.huggingface_cache
26
27# # # # Change ownership of directories to the non-root user
28# # # RUN chown -R nobody:nogroup /app/nltk_data /app/.huggingface_cache /app
29
30# # # # Switch to a non-root user
31# # # USER nobody
32
33# # # # Make port 7860 available to the world outside this container
34# # # EXPOSE 7860
35
36# # # # Command to run the application
37# # # CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]
38
39
40# # Use the official Python image from the Docker Hub
41# FROM python:3.10.0-slim-buster
42
43# # Set the working directory in the container
44# WORKDIR /app
45
46# # Copy the current directory contents into the container at /app
47# COPY . /app
48
49# # Upgrade pip to the latest version
50# RUN pip install --upgrade pip
51
52# # Install build essentials and gfortran
53# RUN apt-get update && apt-get install -y \
54# build-essential \
55# gfortran \
56# && rm -rf /var/lib/apt/lists/*
57
58# # Install any needed packages specified in requirements.txt
59# RUN pip install --no-cache-dir -r requirements.txt
60
61# # Install NumPy version 1.21.0
62# RUN pip install --no-cache-dir numpy==1.21.0
63
64# # Create directories for NLTK and Hugging Face cache data
65# RUN mkdir -p /app/nltk_data /app/.cache/huggingface /app/.huggingface_cache
66
67# # Download NLTK data (punkt and wordnet)
68# RUN python -m nltk.downloader -d /app/nltk_data punkt wordnet
69
70# # Set environment variables
71# ENV NLTK_DATA=/app/nltk_data
72# ENV HF_HOME=/app/.huggingface_cache
73# ENV TRANSFORMERS_CACHE=/app/.huggingface_cache
74
75# # Change ownership of directories to the non-root user
76# RUN chown -R nobody:nogroup /app/nltk_data /app/.huggingface_cache /app
77
78# # Switch to a non-root user
79# USER nobody
80
81# # Make port 7860 available to the world outside this container
82# EXPOSE 7860
83
84# # Command to run the application
85# CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]
86
87
88
89
90# Use the official Python image from the Docker Hub
91FROM python:3.10.0-slim-buster
92
93# Set the working directory in the container
94WORKDIR /app
95
96# Copy the current directory contents into the container at /app
97COPY . /app
98
99# Upgrade pip to the latest version
100RUN pip install --upgrade pip
101
102# Install build essentials and gfortran
103RUN apt-get update && apt-get install -y \
104 build-essential \
105 gfortran \
106 && rm -rf /var/lib/apt/lists/*
107
108# Install any needed packages specified in requirements.txt
109RUN pip install --no-cache-dir -r requirements.txt
110
111# Install NumPy version 1.21.0
112RUN pip install --no-cache-dir numpy==1.21.0
113
114# Create directories for NLTK and Hugging Face cache data
115RUN mkdir -p /app/nltk_data /app/.cache/huggingface /app/.huggingface_cache
116
117# Download NLTK data (punkt and wordnet)
118RUN python -m nltk.downloader -d /app/nltk_data punkt wordnet
119
120# Set environment variables
121ENV NLTK_DATA=/app/nltk_data
122ENV HF_HOME=/app/.huggingface_cache
123ENV TRANSFORMERS_CACHE=/app/.huggingface_cache
124
125# Change ownership of directories to the non-root user
126RUN chown -R nobody:nogroup /app/nltk_data /app/.huggingface_cache /app
127
128# Switch to a non-root user
129USER nobody
130
131# Make port 7860 available to the world outside this container
132EXPOSE 7860
133
134# Command to run the application
135CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "2", "--timeout", "120", "app:app"]
136
137 