Kavin1701 commited on
Commit
b89cd53
·
verified ·
1 Parent(s): 8f19d39

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -9
Dockerfile CHANGED
@@ -1,19 +1,27 @@
1
  FROM python:3.10
2
 
 
3
  WORKDIR /python-docker
4
 
5
- RUN useradd -m -u 1000 user
6
- USER user
7
-
8
  COPY requirements.txt requirements.txt
9
- RUN apt-get update && apt-get install git -y
10
- RUN pip3 install -r requirements.txt
11
- RUN apt-get update && apt-get install -y ffmpeg
 
 
 
 
 
 
 
12
  RUN python -c "from transformers import pipeline; pipeline('automatic-speech-recognition', model='openai/whisper-small')"
13
- COPY . .
14
 
15
- COPY --chown=user:user . /python-docker
 
16
 
 
17
  EXPOSE 8001
18
 
19
- CMD ["uvicorn", "fastapi_app:app", "--host", "0.0.0.0", "--port", "8001"]
 
 
1
  FROM python:3.10
2
 
3
+ # Set the working directory
4
  WORKDIR /python-docker
5
 
6
+ # Copy the requirements file and install dependencies
 
 
7
  COPY requirements.txt requirements.txt
8
+ RUN apt-get update && apt-get install -y git ffmpeg
9
+
10
+ # Install Python dependencies without caching
11
+ RUN pip install --no-cache-dir -r requirements.txt
12
+
13
+ # Create cache directories for Hugging Face and set permissions
14
+ RUN mkdir -p /python-docker/.cache/huggingface && \
15
+ chown -R 1000:1000 /python-docker/.cache
16
+
17
+ # Install Whisper model to ensure it's available
18
  RUN python -c "from transformers import pipeline; pipeline('automatic-speech-recognition', model='openai/whisper-small')"
 
19
 
20
+ # Copy the entire application
21
+ COPY --chown=1000:1000 . .
22
 
23
+ # Expose the port the app runs on
24
  EXPOSE 8001
25
 
26
+ # Set the command to run the application
27
+ CMD ["uvicorn", "fastapi_app:app", "--host", "0.0.0.0", "--port", "8001"]