molehh commited on
Commit
f575af9
·
1 Parent(s): cac0162

first commit

Browse files
Files changed (1) hide show
  1. dockerfile +30 -1
dockerfile CHANGED
@@ -1,14 +1,43 @@
1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  FROM python:3.9
3
 
 
4
  RUN useradd -m -u 1000 user
5
  USER user
 
 
6
  ENV PATH="/home/user/.local/bin:$PATH"
7
 
 
8
  WORKDIR /app
9
 
10
- COPY --chown=user ./requirements.txt requirements.txt
 
 
 
11
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
12
 
 
13
  COPY --chown=user . /app
 
 
 
 
 
14
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
 
2
+ # FROM python:3.9
3
+
4
+ # RUN useradd -m -u 1000 user
5
+ # USER user
6
+ # ENV PATH="/home/user/.local/bin:$PATH"
7
+
8
+ # WORKDIR /app
9
+
10
+ # COPY --chown=user ./requirements.txt requirements.txt
11
+ # RUN pip install --no-cache-dir --upgrade -r requirements.txt
12
+
13
+ # COPY --chown=user . /app
14
+ # CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
15
+
16
+
17
+ # Use official Python image
18
  FROM python:3.9
19
 
20
+ # Create a non-root user for security
21
  RUN useradd -m -u 1000 user
22
  USER user
23
+
24
+ # Set environment variables
25
  ENV PATH="/home/user/.local/bin:$PATH"
26
 
27
+ # Set working directory
28
  WORKDIR /app
29
 
30
+ # Copy dependency file first (for better caching)
31
+ COPY --chown=user requirements.txt /app/requirements.txt
32
+
33
+ # Install dependencies
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
+ # Expose the port used by the application
40
+ EXPOSE 7860
41
+
42
+ # Run the FastAPI app with Uvicorn
43
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]