WebashalarForML
commited on
Commit
•
38c768a
1
Parent(s):
f41cc2b
Create Dockerfile
Browse files- Dockerfile +38 -0
Dockerfile
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use an official Python runtime as a parent image
|
2 |
+
FROM python:3.9-slim
|
3 |
+
|
4 |
+
# Set environment variables for Python
|
5 |
+
ENV PYTHONDONTWRITEBYTECODE 1
|
6 |
+
ENV PYTHONUNBUFFERED 1
|
7 |
+
|
8 |
+
# Set the working directory
|
9 |
+
WORKDIR /app
|
10 |
+
|
11 |
+
# Copy the requirements file into the container at /app
|
12 |
+
COPY requirements.txt /app/
|
13 |
+
|
14 |
+
# Install any needed packages specified in requirements.txt
|
15 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
16 |
+
|
17 |
+
# Create the directory for session storage and set permissions
|
18 |
+
RUN mkdir -p /tmp/flask_sessions && chmod 777 /tmp/flask_sessions
|
19 |
+
|
20 |
+
# Create flask_sessions directory and set permissions
|
21 |
+
RUN mkdir -p /app/flask_sessions && chmod -R 777 /app/flask_sessions
|
22 |
+
|
23 |
+
# Copy the rest of the application code to /app
|
24 |
+
COPY . /app/
|
25 |
+
|
26 |
+
# Ensure the upload directory has the correct permissions
|
27 |
+
RUN mkdir -p /app/uploads && \
|
28 |
+
chmod -R 777 /app/uploads
|
29 |
+
|
30 |
+
# Expose the port that the app runs on
|
31 |
+
EXPOSE 7860
|
32 |
+
|
33 |
+
# Set environment variables for Flask
|
34 |
+
ENV FLASK_APP=app.py
|
35 |
+
ENV FLASK_ENV=production
|
36 |
+
|
37 |
+
# Command to run the application
|
38 |
+
CMD ["gunicorn", "-w", "1", "-b", "0.0.0.0:7860", "--timeout", "120", "app:app"]
|