Spaces:
Build error

Ashad001 commited on
Commit
be66ff5
·
1 Parent(s): 08b9e89

ig i made it

Browse files
Files changed (2) hide show
  1. Dockerfile +12 -10
  2. requirements.txt +1 -0
Dockerfile CHANGED
@@ -1,22 +1,24 @@
1
- FROM python:3.12-slim
2
 
3
- # Create a non-root user
 
 
 
 
 
 
4
  RUN useradd -m -u 1000 user
5
  USER user
6
-
7
- # Set environment variables
8
  ENV PATH="/home/user/.local/bin:$PATH"
9
- ENV PYTHONUNBUFFERED=1
10
 
11
- # Set the working directory
12
  WORKDIR /app
13
 
14
- # Copy and install requirements
15
  COPY --chown=user ./requirements.txt requirements.txt
16
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
17
 
18
- # Copy the application code
19
- COPY --chown=user . .
20
 
21
- # Command to run the application
22
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ FROM python:3.12
2
 
3
+ # Install necessary system dependencies for OpenCV
4
+ RUN apt-get update && \
5
+ apt-get install -y --no-install-recommends \
6
+ libgl1-mesa-glx \
7
+ && rm -rf /var/lib/apt/lists/*
8
+
9
+ # Create a user and switch to it
10
  RUN useradd -m -u 1000 user
11
  USER user
 
 
12
  ENV PATH="/home/user/.local/bin:$PATH"
 
13
 
 
14
  WORKDIR /app
15
 
16
+ # Copy and install Python dependencies
17
  COPY --chown=user ./requirements.txt requirements.txt
18
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
19
 
20
+ # Copy the rest of the application code
21
+ COPY --chown=user . /app
22
 
23
+ # Run the application with Uvicorn
24
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
requirements.txt CHANGED
@@ -60,6 +60,7 @@ mypy-extensions==1.0.0
60
  narwhals==1.9.2
61
  numpy==2.1.1
62
  openai==1.51.2
 
63
  opencv-python==4.10.0.84
64
  opencv-python-headless==4.10.0.84
65
  optuna==4.0.0
 
60
  narwhals==1.9.2
61
  numpy==2.1.1
62
  openai==1.51.2
63
+ opencv-contrib-python==4.10.0.84
64
  opencv-python==4.10.0.84
65
  opencv-python-headless==4.10.0.84
66
  optuna==4.0.0