Vivek0912 commited on
Commit
6a99b2b
·
1 Parent(s): fa4266d

updated docker

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -16
Dockerfile CHANGED
@@ -2,27 +2,22 @@
2
  # Use the official Python 3.11.5 image
3
  FROM python:3.11.5
4
 
5
- # Expose FastAPI port
6
  EXPOSE 7860
7
 
8
- # Keeps Python from generating .pyc files in the container
9
  ENV PYTHONDONTWRITEBYTECODE=1
10
-
11
- # Turns off buffering for easier logging
12
  ENV PYTHONUNBUFFERED=1
13
 
14
- # Set working directory inside the backend folder
15
- WORKDIR /app
16
-
17
- # Copy only the backend folder
18
- COPY backend/ /app/
19
-
20
- # Install dependencies from the backend folder
21
  RUN python -m pip install --no-cache-dir -r requirements.txt
22
 
23
- # Create a non-root user with permission to access /app
24
- RUN adduser -u 5678 --disabled-password --gecos "" --home /app appuser && chown -R appuser /app
25
- USER appuser
 
 
 
26
 
27
- # Start FastAPI with Gunicorn & Uvicorn worker
28
- CMD ["gunicorn", "--bind", "0.0.0.0:7860", "-k", "uvicorn.workers.UvicornWorker", "main:app"]
 
2
  # Use the official Python 3.11.5 image
3
  FROM python:3.11.5
4
 
 
5
  EXPOSE 7860
6
 
7
+ # Environment settings
8
  ENV PYTHONDONTWRITEBYTECODE=1
 
 
9
  ENV PYTHONUNBUFFERED=1
10
 
11
+ # Install dependencies
12
+ COPY requirements.txt .
 
 
 
 
 
13
  RUN python -m pip install --no-cache-dir -r requirements.txt
14
 
15
+ # Set working directory
16
+ WORKDIR /app
17
+ COPY . /app
18
+
19
+ # Ensure correct permissions (optional but recommended)
20
+ RUN chown -R root:root /app
21
 
22
+ # Start the FastAPI application
23
+ CMD ["gunicorn", "--bind", "0.0.0.0:7860", "-k", "uvicorn.workers.UvicornWorker", "backend.main:app"]