starlord3307 commited on
Commit
117fb37
·
verified ·
1 Parent(s): 841b53e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -16
Dockerfile CHANGED
@@ -1,25 +1,21 @@
1
- # Use official Python image
2
- FROM python:3.9
3
 
4
- # Set cache directory for Hugging Face
5
- ENV HF_HOME=/home/user/cache
6
 
7
- # Create cache directories & set correct permissions before switching users
8
- RUN mkdir -p $HF_HOME && chmod -R 777 $HF_HOME
9
 
10
- # Install dependencies
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 server
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"]