Sanket17 commited on
Commit
56ae4b6
·
verified ·
1 Parent(s): dc21e98

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +23 -17
Dockerfile CHANGED
@@ -1,26 +1,32 @@
1
- # For more information, please refer to https://aka.ms/vscode-docker-python
2
- FROM python:3-slim
3
 
4
- EXPOSE 5002
 
5
 
6
- # Keeps Python from generating .pyc files in the container
7
- ENV PYTHONDONTWRITEBYTECODE=1
 
 
 
 
8
 
9
- # Turns off buffering for easier container logging
10
- ENV PYTHONUNBUFFERED=1
11
 
12
- # Install pip requirements
13
  COPY requirements.txt .
14
- RUN python -m pip install -r requirements.txt
15
 
16
- WORKDIR /app
17
- COPY . /app
 
 
18
 
19
- # Creates a non-root user with an explicit UID and adds permission to access the /app folder
20
- # For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers
21
- RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
22
- USER appuser
23
 
 
 
24
 
25
- # During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug
26
- CMD ["gunicorn", "--bind", "0.0.0.0:5002", "weights.convert_safetensor_to_pt:app"]
 
1
+ # Use a specific version of Python (e.g., Python 3.9 for better compatibility with PyTorch)
2
+ FROM python:3.9-slim
3
 
4
+ # Set environment variables to avoid interactive prompts
5
+ ENV DEBIAN_FRONTEND=noninteractive
6
 
7
+ # Install required system dependencies
8
+ RUN apt-get update && apt-get install -y \
9
+ libgl1-mesa-glx \ # For OpenCV compatibility
10
+ libglib2.0-0 \ # For OpenCV compatibility
11
+ build-essential \ # For building certain Python packages
12
+ && rm -rf /var/lib/apt/lists/*
13
 
14
+ # Set the working directory
15
+ WORKDIR /app
16
 
17
+ # Copy requirements file
18
  COPY requirements.txt .
 
19
 
20
+ # Install Python dependencies
21
+ RUN python -m pip install --upgrade pip && \
22
+ python -m pip install torch torchvision -f https://download.pytorch.org/whl/cpu/torch_stable.html && \
23
+ python -m pip install -r requirements.txt
24
 
25
+ # Copy the application code
26
+ COPY . .
 
 
27
 
28
+ # Expose the application port
29
+ EXPOSE 8000
30
 
31
+ # Command to run the application
32
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]