fyp1 commited on
Commit
1878f65
1 Parent(s): 02d46b3

Update dockerfile

Browse files
Files changed (1) hide show
  1. dockerfile +19 -22
dockerfile CHANGED
@@ -1,22 +1,19 @@
1
- # Use the official Python image
2
- FROM python:3.9-slim
3
-
4
- # Set the working directory
5
- WORKDIR /app
6
-
7
- # Copy all files from the local directory to the container
8
- COPY . /app
9
-
10
- # Install system dependencies
11
- RUN apt-get update && apt-get install -y \
12
- libgl1-mesa-glx \
13
- && rm -rf /var/lib/apt/lists/*
14
-
15
- # Install Python dependencies
16
- RUN pip install --no-cache-dir -r requirements.txt
17
-
18
- # Expose port for the FastAPI server
19
- EXPOSE 7860
20
-
21
- # Run the FastAPI app
22
- CMD ["python", "app.py"]
 
1
+ # Use the Python 3.9 base image
2
+ FROM python:3.9
3
+
4
+ # Create a non-root user
5
+ RUN useradd -m -u 1000 user
6
+ USER user
7
+ ENV PATH="/home/user/.local/bin:$PATH"
8
+
9
+ WORKDIR /app
10
+
11
+ # Install Python dependencies
12
+ COPY --chown=user ./requirements.txt requirements.txt
13
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
14
+
15
+ # Copy the application files
16
+ COPY --chown=user . /app
17
+
18
+ # Expose the app on port 7860
19
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]