Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +7 -6
Dockerfile
CHANGED
|
@@ -4,26 +4,27 @@ FROM python:3.10-slim
|
|
| 4 |
# 2. Set working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
-
# 3. Install system dependencies
|
|
|
|
| 8 |
RUN apt-get update && apt-get install -y \
|
| 9 |
-
libgl1
|
| 10 |
libglib2.0-0 \
|
| 11 |
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
|
| 13 |
-
# 4. Create a non-root user (
|
| 14 |
RUN useradd -m -u 1000 user
|
| 15 |
USER user
|
| 16 |
ENV PATH="/home/user/.local/bin:$PATH"
|
| 17 |
|
| 18 |
-
# 5. Copy files with
|
| 19 |
COPY --chown=user . .
|
| 20 |
|
| 21 |
# 6. Install Python Dependencies
|
| 22 |
RUN pip install --no-cache-dir --upgrade pip && \
|
| 23 |
pip install --no-cache-dir -r requirements.txt
|
| 24 |
|
| 25 |
-
# 7. Expose
|
| 26 |
EXPOSE 7860
|
| 27 |
|
| 28 |
-
# 8. Run
|
| 29 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 4 |
# 2. Set working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# 3. Install system dependencies
|
| 8 |
+
# FIX: 'libgl1-mesa-glx' is renamed to 'libgl1' in newer Linux versions
|
| 9 |
RUN apt-get update && apt-get install -y \
|
| 10 |
+
libgl1 \
|
| 11 |
libglib2.0-0 \
|
| 12 |
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
|
| 14 |
+
# 4. Create a non-root user (Hugging Face requirement)
|
| 15 |
RUN useradd -m -u 1000 user
|
| 16 |
USER user
|
| 17 |
ENV PATH="/home/user/.local/bin:$PATH"
|
| 18 |
|
| 19 |
+
# 5. Copy files with permissions
|
| 20 |
COPY --chown=user . .
|
| 21 |
|
| 22 |
# 6. Install Python Dependencies
|
| 23 |
RUN pip install --no-cache-dir --upgrade pip && \
|
| 24 |
pip install --no-cache-dir -r requirements.txt
|
| 25 |
|
| 26 |
+
# 7. Expose Port
|
| 27 |
EXPOSE 7860
|
| 28 |
|
| 29 |
+
# 8. Run App
|
| 30 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|