Bunpheng commited on
Commit
7972539
·
verified ·
1 Parent(s): 099d1e6

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -16
Dockerfile CHANGED
@@ -15,27 +15,29 @@
15
  # COPY --chown=user . /app
16
  # CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
17
 
18
- FROM python:3.9
 
19
 
20
- # Create a user
21
- RUN useradd -m -u 1000 user
22
-
23
- # Switch to the created user
24
- USER user
25
-
26
- # Set PATH to include the user-specific bin directory
27
- ENV PATH="/home/user/.local/bin:$PATH"
28
 
29
  # Set the working directory
30
  WORKDIR /app
31
 
32
- # Copy requirements and install dependencies
33
- COPY --chown=user ./requirements.txt requirements.txt
34
- RUN pip install --no-cache-dir --upgrade -r requirements.txt
 
 
 
 
 
 
35
 
36
- # Copy the rest of the application code
37
- COPY --chown=user . /app
38
 
39
- # Command to run the application
40
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
41
 
 
15
  # COPY --chown=user . /app
16
  # CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
17
 
18
+ # Use a base image with Python and necessary dependencies
19
+ FROM python:3.10-slim
20
 
21
+ # Set environment variables
22
+ ENV PYTHONDONTWRITEBYTECODE=1
23
+ ENV PYTHONUNBUFFERED=1
 
 
 
 
 
24
 
25
  # Set the working directory
26
  WORKDIR /app
27
 
28
+ # Install necessary packages
29
+ COPY requirements.txt .
30
+ RUN pip install --no-cache-dir -r requirements.txt
31
+
32
+ # Copy the application code and model download script
33
+ COPY . .
34
+
35
+ # Run the model download script
36
+ RUN python download_model.py
37
 
38
+ # Expose the port the app runs on
39
+ EXPOSE 8000
40
 
41
+ # Command to run the FastAPI app
42
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
43