shakeel143 commited on
Commit
63d6eaa
·
verified ·
1 Parent(s): e2eb198

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -13
Dockerfile CHANGED
@@ -1,20 +1,19 @@
1
- FROM python:3.9
2
 
3
- RUN useradd -m -u 1000 user
4
- USER user
5
- ENV PATH="/home/user/.local/bin:$PATH"
6
 
7
- WORKDIR /app
 
8
 
9
- # Copy requirements and install
10
- COPY --chown=user ./requirements.txt requirements.txt
11
- RUN pip install --no-cache-dir --upgrade -r requirements.txt
12
 
13
- # Copy the rest of the application
14
- COPY --chown=user . /app
15
 
16
- # Expose the correct port
17
  EXPOSE 7860
18
 
19
- # Run the FastAPI app
20
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
1
 
2
+ # Copy requirements first to leverage Docker cache
3
+ COPY --chown=user requirements.txt .
4
+ RUN pip install --no-cache-dir -r requirements.txt
5
 
6
+ # Copy application code
7
+ COPY --chown=user . .
8
 
9
+ # Create models directory
10
+ RUN mkdir -p models && chown user:user models
 
11
 
12
+ # Switch to non-root user
13
+ USER user
14
 
15
+ # Expose the port
16
  EXPOSE 7860
17
 
18
+ # Command to run the application
19
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]