kabeerahmad commited on
Commit
be5bfd0
·
verified ·
1 Parent(s): 48bdefc

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -10
Dockerfile CHANGED
@@ -1,19 +1,27 @@
1
  # 1. Base image
2
  FROM python:3.10-slim
3
 
4
- # 2. Create & switch to app directory
 
 
 
 
 
 
 
 
 
5
  WORKDIR /app
 
6
 
7
- # 3. Copy and install Python dependencies
8
- COPY requirements.txt .
9
  RUN pip install --upgrade pip \
10
  && pip install --no-cache-dir -r requirements.txt
11
 
12
- # 4. Copy your code
13
- COPY . .
14
-
15
- # 5. Expose the port your FastAPI will run on
16
- EXPOSE 8000
17
 
18
- # 6. Default command
19
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080"]
 
 
1
  # 1. Base image
2
  FROM python:3.10-slim
3
 
4
+ # 2. Install OS-level deps for rembg / PIL / OpenCV, etc.
5
+ RUN apt-get update \
6
+ && apt-get install -y --no-install-recommends \
7
+ libgl1-mesa-glx \
8
+ libglib2.0-0 \
9
+ build-essential \
10
+ && rm -rf /var/lib/apt/lists/*
11
+
12
+ # 3. Create a non-root user (optional but recommended)
13
+ RUN useradd --create-home appuser
14
  WORKDIR /app
15
+ USER appuser
16
 
17
+ # 4. Copy & install Python deps
18
+ COPY --chown=appuser:appuser requirements.txt .
19
  RUN pip install --upgrade pip \
20
  && pip install --no-cache-dir -r requirements.txt
21
 
22
+ # 5. Copy your application code
23
+ COPY --chown=appuser:appuser . .
 
 
 
24
 
25
+ # 6. Expose and run
26
+ EXPOSE 8080
27
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080"]