Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +37 -27
Dockerfile
CHANGED
@@ -1,28 +1,38 @@
|
|
1 |
-
# Use an official Python runtime as a parent image
|
2 |
-
FROM python:3.11-slim
|
3 |
-
|
4 |
-
# Install system dependencies
|
5 |
-
RUN apt-get update && apt-get install -y gcc
|
6 |
-
|
7 |
-
# Set the working directory to /app
|
8 |
-
WORKDIR /app
|
9 |
-
|
10 |
-
# Copy the requirements file and install dependencies
|
11 |
-
COPY requirements.txt .
|
12 |
-
RUN pip install --upgrade pip && pip install -r requirements.txt
|
13 |
-
|
14 |
-
# Create necessary directories with appropriate permissions
|
15 |
-
RUN mkdir -p /app/cache /app/uploads /app/data /app/chats && chmod -R 777 /app/cache /app/uploads /app/data /app/chats
|
16 |
-
RUN chmod -R 777 /app
|
17 |
-
|
18 |
-
#
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
CMD ["gunicorn", "-k", "eventlet", "-w", "1", "-b", "0.0.0.0:7860", "--timeout", "600", "app:app"]
|
|
|
1 |
+
# Use an official Python runtime as a parent image
|
2 |
+
FROM python:3.11-slim
|
3 |
+
|
4 |
+
# Install system dependencies
|
5 |
+
RUN apt-get update && apt-get install -y gcc
|
6 |
+
|
7 |
+
# Set the working directory to /app
|
8 |
+
WORKDIR /app
|
9 |
+
|
10 |
+
# Copy the requirements file and install dependencies
|
11 |
+
COPY requirements.txt .
|
12 |
+
RUN pip install --upgrade pip && pip install -r requirements.txt
|
13 |
+
|
14 |
+
# Create necessary directories with appropriate permissions
|
15 |
+
RUN mkdir -p /app/cache /app/uploads /app/data /app/chats && chmod -R 777 /app/cache /app/uploads /app/data /app/chats
|
16 |
+
RUN chmod -R 777 /app
|
17 |
+
|
18 |
+
# Ensure all relevant directories have the correct permissions
|
19 |
+
RUN chmod -R 777 /app/cache
|
20 |
+
RUN chmod -R 777 /app/data
|
21 |
+
RUN chmod -R 777 /app/uploads
|
22 |
+
RUN chmod -R 777 /app/chats
|
23 |
+
RUN chmod -R 777 /app
|
24 |
+
|
25 |
+
# Copy the rest of the application code to /app
|
26 |
+
COPY . /app/
|
27 |
+
|
28 |
+
# Copy the application code
|
29 |
+
COPY . .
|
30 |
+
|
31 |
+
# Set environment variables
|
32 |
+
ENV FLASK_APP=app.py \
|
33 |
+
FLASK_ENV=production
|
34 |
+
|
35 |
+
EXPOSE 7860
|
36 |
+
|
37 |
+
# Run the application using Gunicorn
|
38 |
CMD ["gunicorn", "-k", "eventlet", "-w", "1", "-b", "0.0.0.0:7860", "--timeout", "600", "app:app"]
|