Spaces:
Runtime error
Runtime error
Create Dockerfile
Browse files- Dockerfile +27 -0
Dockerfile
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.9
|
2 |
+
|
3 |
+
# Set environment variables
|
4 |
+
ENV MPLCONFIGDIR /tmp/matplotlib-cache
|
5 |
+
ENV NLTK_DATA /nltk_data
|
6 |
+
ENV FONTCONFIG_PATH=/tmp/fontconfig-cache
|
7 |
+
|
8 |
+
# Create writable directories
|
9 |
+
RUN mkdir -p /tmp/matplotlib-cache /nltk_data \
|
10 |
+
&& chmod 777 /tmp/matplotlib-cache /nltk_data
|
11 |
+
RUN mkdir -p $FONTCONFIG_PATH && chmod 777 $FONTCONFIG_PATH
|
12 |
+
# Set the working directory
|
13 |
+
WORKDIR /
|
14 |
+
|
15 |
+
# Copy requirements.txt and install dependencies
|
16 |
+
COPY ./requirements.txt /requirements.txt
|
17 |
+
RUN pip install --no-cache-dir --upgrade -r /requirements.txt
|
18 |
+
|
19 |
+
# Copy the rest of the application files
|
20 |
+
COPY . .
|
21 |
+
|
22 |
+
# Expose the required port
|
23 |
+
EXPOSE 7860
|
24 |
+
|
25 |
+
# Run the application with Gunicorn
|
26 |
+
CMD ["gunicorn", "-w", "1", "-b", "0.0.0.0:7860", "app:app"]
|
27 |
+
|