asv7j commited on
Commit
486aa0e
1 Parent(s): 04b68af

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -8
Dockerfile CHANGED
@@ -1,16 +1,21 @@
 
1
  FROM python:3.9
 
 
2
  RUN useradd -m -u 1000 user
3
  USER user
 
 
4
  ENV PATH="/home/user/.local/bin:$PATH"
5
  WORKDIR /code
6
 
7
- RUN pip install fastapi requests libretranslate uvicorn[standard]==0.17.*
 
 
 
8
 
9
- COPY . .
10
- COPY --chown=user . /app
11
- # Expose the port FastAPI will use
12
- # Expose the port FastAPI will use
13
- EXPOSE 8000
14
 
15
- # Command to run the FastAPI app with uvicorn
16
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
 
1
+ # Use the official Python image from the Docker Hub
2
  FROM python:3.9
3
+
4
+ # Create a new user and set permissions
5
  RUN useradd -m -u 1000 user
6
  USER user
7
+
8
+ # Set environment variables
9
  ENV PATH="/home/user/.local/bin:$PATH"
10
  WORKDIR /code
11
 
12
+ RUN pip install libretranslate waitress
13
+
14
+ # Copy the application code
15
+ COPY --chown=user . .
16
 
17
+ # Expose the port the app runs on
18
+ EXPOSE 7860
 
 
 
19
 
20
+ # Run the application using waitress (recommended for production)
21
+ CMD ["waitress-serve", "--host", "0.0.0.0", "--port", "7860", "app:main"]