Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +12 -16
Dockerfile
CHANGED
|
@@ -1,25 +1,21 @@
|
|
| 1 |
-
# Use
|
| 2 |
-
FROM
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
ENV
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
RUN
|
| 9 |
|
| 10 |
-
#
|
| 11 |
-
RUN pip install --no-cache-dir --upgrade fastapi uvicorn transformers torch bitsandbytes accelerate
|
| 12 |
-
|
| 13 |
-
# ✅ Create a non-root user (for security) and switch to it
|
| 14 |
-
RUN useradd -m -u 1000 user
|
| 15 |
-
USER user
|
| 16 |
-
ENV PATH="/home/user/.local/bin:$PATH"
|
| 17 |
-
|
| 18 |
-
# Set working directory
|
| 19 |
WORKDIR /app
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
# Copy application files
|
| 22 |
COPY app.py .
|
| 23 |
|
| 24 |
-
# Run the FastAPI
|
| 25 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
+
# Use Ubuntu 22.04 for updated system libraries
|
| 2 |
+
FROM ubuntu:22.04
|
| 3 |
|
| 4 |
+
# Set non-interactive mode (prevents prompts)
|
| 5 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
| 6 |
|
| 7 |
+
# Install system dependencies (Fixes GLIBCXX issue)
|
| 8 |
+
RUN apt update && apt install -y libstdc++6 python3 python3-pip
|
| 9 |
|
| 10 |
+
# Set working directory inside the container
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
WORKDIR /app
|
| 12 |
|
| 13 |
+
# Copy requirements.txt and install Python dependencies
|
| 14 |
+
COPY requirements.txt .
|
| 15 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 16 |
+
|
| 17 |
# Copy application files
|
| 18 |
COPY app.py .
|
| 19 |
|
| 20 |
+
# Run the FastAPI app
|
| 21 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|