Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +9 -13
Dockerfile
CHANGED
@@ -1,32 +1,28 @@
|
|
1 |
# Use an official Python runtime as a parent image
|
2 |
FROM python:3.11-slim
|
3 |
|
4 |
-
# Install
|
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
|
11 |
COPY requirements.txt .
|
12 |
-
|
13 |
-
# Upgrade pip and install any needed packages specified in requirements.txt
|
14 |
RUN pip install --upgrade pip && pip install -r requirements.txt
|
15 |
|
16 |
-
# Create
|
17 |
RUN mkdir -p /app/cache /app/uploads /app/data && chmod -R 777 /app/cache /app/uploads /app/data
|
18 |
-
RUN chmod -R 777 /app
|
19 |
|
20 |
-
# Copy the
|
21 |
COPY . .
|
22 |
|
23 |
-
#
|
24 |
-
COPY . /app/
|
25 |
-
|
26 |
ENV FLASK_APP=app.py \
|
27 |
-
FLASK_ENV=production\
|
28 |
-
DATABASE_URI=sqlite:///employee.db
|
29 |
|
30 |
EXPOSE 7860
|
31 |
|
32 |
-
|
|
|
|
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 && chmod -R 777 /app/cache /app/uploads /app/data
|
|
|
16 |
|
17 |
+
# Copy the application code
|
18 |
COPY . .
|
19 |
|
20 |
+
# Set environment variables
|
|
|
|
|
21 |
ENV FLASK_APP=app.py \
|
22 |
+
FLASK_ENV=production \
|
23 |
+
#DATABASE_URI=sqlite:///employee.db
|
24 |
|
25 |
EXPOSE 7860
|
26 |
|
27 |
+
# Run the application using Gunicorn
|
28 |
+
CMD ["gunicorn", "-w", "1", "-b", "0.0.0.0:7860", "--timeout", "120", "app:app"]
|