Noel-Teens commited on
Commit
e4cecb2
·
1 Parent(s): c558cde
Files changed (1) hide show
  1. Dockerfile +13 -22
Dockerfile CHANGED
@@ -1,32 +1,23 @@
1
- # Use Python 3.10 slim image
2
  FROM python:3.10-slim
3
 
4
- # Create a non-root user
5
- RUN useradd -m -u 1000 user
6
 
7
- # Set environment path and working directory
8
- ENV PATH="/home/user/.local/bin:$PATH"
9
  WORKDIR /app
10
 
11
- # Copy and install requirements
12
- COPY --chown=user requirements.txt requirements.txt
 
13
 
14
- RUN pip install --no-cache-dir --upgrade pip \
15
- && pip install --no-cache-dir --upgrade -r requirements.txt
16
 
17
- # Debug step: search for deprecated MutableSet usage
18
- RUN grep -r "MutableSet" /usr/local/lib/python*/site-packages || echo "No MutableSet found"
19
-
20
-
21
-
22
- # Copy all app code
23
- COPY --chown=user . /app
24
-
25
- RUN python manage.py makemigrations
26
- RUN python manage.py migrate
27
  # Switch to non-root user
28
  USER user
29
 
30
- # Optional: drop into a bash shell for exploration (instead of running Django immediately)
31
- # CMD ["/bin/bash"]
32
- CMD ["python", "manage.py", "runserver", "0.0.0.0:7860"]
 
 
 
 
1
  FROM python:3.10-slim
2
 
3
+ # Create a non-root user (optional but good for security)
4
+ RUN useradd -m user
5
 
6
+ # Set working directory
 
7
  WORKDIR /app
8
 
9
+ # Copy requirements and install them
10
+ COPY --chown=user requirements.txt .
11
+ RUN pip install --no-cache-dir -r requirements.txt
12
 
13
+ # Copy rest of the project files
14
+ COPY --chown=user . .
15
 
 
 
 
 
 
 
 
 
 
 
16
  # Switch to non-root user
17
  USER user
18
 
19
+ # Expose port
20
+ EXPOSE 8000
21
+
22
+ # Run the Django server
23
+ CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]