Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +6 -12
Dockerfile
CHANGED
|
@@ -1,33 +1,27 @@
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
| 3 |
-
# Set working directory
|
| 4 |
WORKDIR /app
|
| 5 |
|
| 6 |
-
# Install system dependencies
|
| 7 |
RUN apt-get update && \
|
| 8 |
apt-get install -y --no-install-recommends \
|
| 9 |
build-essential \
|
| 10 |
-
git \
|
| 11 |
-
|
| 12 |
|
| 13 |
-
# Optional: Create a non-root user
|
| 14 |
RUN useradd -ms /bin/bash myuser
|
| 15 |
|
| 16 |
-
# Copy requirements first
|
| 17 |
COPY requirements.txt .
|
| 18 |
-
|
| 19 |
-
# Install Python dependencies
|
| 20 |
RUN pip install --upgrade pip && \
|
| 21 |
pip install --no-cache-dir -r requirements.txt
|
| 22 |
|
| 23 |
-
# Copy the rest of the app
|
| 24 |
COPY . .
|
| 25 |
|
| 26 |
-
#
|
|
|
|
|
|
|
|
|
|
| 27 |
USER myuser
|
| 28 |
|
| 29 |
-
# Expose port Flask will run on
|
| 30 |
EXPOSE 7860
|
| 31 |
|
| 32 |
-
# Run the Flask app
|
| 33 |
CMD ["python", "main.py"]
|
|
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
|
|
|
| 5 |
RUN apt-get update && \
|
| 6 |
apt-get install -y --no-install-recommends \
|
| 7 |
build-essential \
|
| 8 |
+
git && \
|
| 9 |
+
rm -rf /var/lib/apt/lists/*
|
| 10 |
|
|
|
|
| 11 |
RUN useradd -ms /bin/bash myuser
|
| 12 |
|
|
|
|
| 13 |
COPY requirements.txt .
|
|
|
|
|
|
|
| 14 |
RUN pip install --upgrade pip && \
|
| 15 |
pip install --no-cache-dir -r requirements.txt
|
| 16 |
|
|
|
|
| 17 |
COPY . .
|
| 18 |
|
| 19 |
+
# 👇 Fix upload folder permission before switching user
|
| 20 |
+
RUN mkdir -p /app/uploads && \
|
| 21 |
+
chown -R myuser:myuser /app/uploads
|
| 22 |
+
|
| 23 |
USER myuser
|
| 24 |
|
|
|
|
| 25 |
EXPOSE 7860
|
| 26 |
|
|
|
|
| 27 |
CMD ["python", "main.py"]
|