ChandimaPrabath commited on
Commit
48ca2cf
·
verified ·
1 Parent(s): 204ae1e

Create dockerfile

Browse files
Files changed (1) hide show
  1. dockerfile +30 -0
dockerfile ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
2
+ # you will also find guides on how best to write your Dockerfile
3
+
4
+ FROM python:3.11
5
+
6
+ # Set DEBIAN_FRONTEND to noninteractive to avoid prompts during apt-get install
7
+ ENV DEBIAN_FRONTEND=noninteractive
8
+
9
+
10
+ # --- User Setup ---
11
+ # Create a non-root user and switch to it
12
+ RUN useradd -m -u 1000 user
13
+ USER user
14
+ ENV PATH="/home/user/.local/bin:$PATH"
15
+ WORKDIR /app
16
+
17
+ # --- Python Package Installation (as user) ---
18
+ # Copy only requirements.txt first to leverage Docker cache
19
+ COPY --chown=user ./requirements.txt requirements.txt
20
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
21
+
22
+ # --- Application Code ---
23
+ # Copy the rest of the application code
24
+ COPY --chown=user . /app
25
+
26
+ # --- Run Command ---
27
+ # Expose the port the app runs on (optional but good practice)
28
+ EXPOSE 7860
29
+ # Start the application
30
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]