SyamSashank commited on
Commit
b24168c
·
verified ·
1 Parent(s): cb7246c

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -12
Dockerfile CHANGED
@@ -1,26 +1,25 @@
1
- # Use a slim Python image for a smaller footprint
2
  FROM python:3.11-slim
3
 
4
- # Set the working directory
5
  WORKDIR /app
6
 
7
- # Create a non-root user for Hugging Face security
 
 
 
8
  RUN useradd -m -u 1000 user
9
  USER user
10
  ENV PATH="/home/user/.local/bin:$PATH"
11
 
12
- # Copy requirements first to leverage Docker cache
13
- # Use --chown=user:user to ensure the new user owns the files
14
  COPY --chown=user:user requirements.txt .
15
-
16
- # Install dependencies
17
  RUN pip install --no-cache-dir -r requirements.txt
18
 
19
- # Copy the rest of the application code
20
  COPY --chown=user:user . .
21
 
22
- # Hugging Face Spaces listens on port 7860 by default
23
- EXPOSE 7860
24
 
25
- # Start the FastAPI app using uvicorn
26
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+
2
  FROM python:3.11-slim
3
 
 
4
  WORKDIR /app
5
 
6
+ # Install system dependencies
7
+ RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
8
+
9
+ # Create a non-root user for security
10
  RUN useradd -m -u 1000 user
11
  USER user
12
  ENV PATH="/home/user/.local/bin:$PATH"
13
 
14
+ # Copy and install dependencies
 
15
  COPY --chown=user:user requirements.txt .
 
 
16
  RUN pip install --no-cache-dir -r requirements.txt
17
 
18
+ # Copy the rest of the application
19
  COPY --chown=user:user . .
20
 
21
+ # Standard OpenEnv port is 8000
22
+ EXPOSE 8000
23
 
24
+ # Start using uvicorn on port 8000
25
+ CMD ["uvicorn", "server.app:app", "--host", "0.0.0.0", "--port", "8000"]