kerols77 commited on
Commit
e72543c
·
verified ·
1 Parent(s): 1f8582e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -32
Dockerfile CHANGED
@@ -1,33 +1,20 @@
1
- # Use Python 3.9 slim image as base
2
- FROM python:3.9-slim
3
-
4
- # Set working directory
5
- WORKDIR /app
6
-
7
- # Install system dependencies
8
- RUN apt-get update && apt-get install -y \
9
- gcc \
10
- g++ \
11
- && rm -rf /var/lib/apt/lists/*
12
-
13
- # Copy requirements file first (for better Docker layer caching)
14
- COPY requirements.txt .
15
-
16
- # Install Python dependencies
17
- RUN pip install --no-cache-dir -r requirements.txt
18
-
19
- # Copy the application code
20
- COPY . .
21
-
22
- # Create data directory for JSON files
23
- RUN mkdir -p data
24
-
25
- # Set environment variables
26
- ENV PYTHONUNBUFFERED=1
27
- ENV PORT=7860
28
-
29
- # Expose the port that the app runs on
30
- EXPOSE 7860
31
-
32
- # Command to run the application
33
  CMD ["python", "app.py"]
 
1
+ FROM python:3.9-slim
2
+
3
+ WORKDIR /app
4
+
5
+ RUN apt-get update && apt-get install -y \
6
+ gcc \
7
+ g++ \
8
+ && rm -rf /var/lib/apt/lists/*
9
+
10
+ COPY requirements.txt .
11
+ RUN pip install --no-cache-dir -r requirements.txt
12
+ COPY . .
13
+ RUN mkdir -p data && chmod 777 data
14
+ RUN useradd -m -u 1000 user
15
+ RUN chown -R user:user /app
16
+ USER user
17
+ ENV PYTHONUNBUFFERED=1
18
+ ENV PORT=7860
19
+ EXPOSE 7860
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  CMD ["python", "app.py"]