Vitrous commited on
Commit
abf547c
·
verified ·
1 Parent(s): 1b4cc34

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +27 -21
Dockerfile CHANGED
@@ -1,40 +1,46 @@
 
1
  FROM python:3.9
2
 
3
- FROM nvidia/cuda:12.1.1-cudnn8-devel-ubuntu22.04
4
-
5
- ARG DEBIAN_FRONTEND=noninteractive
6
-
7
  RUN apt-get update && apt-get install --no-install-recommends -y \
8
- build-essential \
9
- python3.9 \
10
- python3-pip \
11
- git \
12
- ffmpeg \
13
- && apt-get clean && rm -rf /var/lib/apt/lists/*
14
 
 
15
  WORKDIR /code
16
 
 
17
  COPY ./requirements.txt /code/requirements.txt
18
-
19
- # For hugging face
20
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
21
 
22
- RUN pip install pyngrok
23
-
24
- RUN ngrok config add-authtoken 1XtU01EKWysplGQ8fz54lVUQpnQ_3KKhw6YNQ5E85rxdkgXx4
25
-
26
- #set up working directory
27
  RUN useradd -m -u 1000 user
28
-
29
  USER user
30
 
 
31
  ENV HOME=/home/user \
32
- PATH=/home/user/.local/bin:$PATH
33
 
 
34
  WORKDIR $HOME/app
35
 
 
36
  COPY --chown=user . $HOME/app
37
- #end of dir set up
38
 
 
 
 
 
 
 
 
 
 
 
 
 
39
 
40
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "2"]
 
 
1
+ # Start from the base Python 3.9 image
2
  FROM python:3.9
3
 
4
+ # Install required packages
 
 
 
5
  RUN apt-get update && apt-get install --no-install-recommends -y \
6
+ build-essential \
7
+ git \
8
+ ffmpeg \
9
+ && apt-get clean && rm -rf /var/lib/apt/lists/*
 
 
10
 
11
+ # Set the working directory
12
  WORKDIR /code
13
 
14
+ # Copy the requirements file and install dependencies
15
  COPY ./requirements.txt /code/requirements.txt
 
 
16
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
17
 
18
+ # Add a new user and switch to that user
 
 
 
 
19
  RUN useradd -m -u 1000 user
 
20
  USER user
21
 
22
+ # Set environment variables
23
  ENV HOME=/home/user \
24
+ PATH=/home/user/.local/bin:$PATH
25
 
26
+ # Set the working directory
27
  WORKDIR $HOME/app
28
 
29
+ # Copy the application files into the container
30
  COPY --chown=user . $HOME/app
 
31
 
32
+ # Install ngrok
33
+ RUN wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip && \
34
+ unzip ngrok-stable-linux-amd64.zip && \
35
+ mv ngrok $HOME/.local/bin && \
36
+ rm ngrok-stable-linux-amd64.zip
37
+
38
+ # Set permissions for ngrok
39
+ RUN chmod +x $HOME/.local/bin/ngrok
40
+
41
+ # Expose the ports for FastAPI and ngrok's web interface
42
+ EXPOSE 7860
43
+ EXPOSE 4040
44
 
45
+ # Run the FastAPI application and ngrok
46
+ CMD ["sh", "-c", "uvicorn app:app --host 0.0.0.0 --port 7860 & sleep 5 && ngrok http 7860"]