Spaces:
Runtime error
Runtime error
Commit ·
e4cecb2
1
Parent(s): c558cde
Final
Browse files- 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
|
| 6 |
|
| 7 |
-
# Set
|
| 8 |
-
ENV PATH="/home/user/.local/bin:$PATH"
|
| 9 |
WORKDIR /app
|
| 10 |
|
| 11 |
-
# Copy and install
|
| 12 |
-
COPY --chown=user requirements.txt
|
|
|
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
| 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 |
-
#
|
| 31 |
-
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 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"]
|