Vitrous commited on
Commit
174263f
·
verified ·
1 Parent(s): 254a4f5

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -17
Dockerfile CHANGED
@@ -1,29 +1,28 @@
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
@@ -32,11 +31,14 @@ COPY --chown=user . $HOME/app
32
  # Download and extract ngrok
33
  RUN wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip && \
34
  unzip ngrok-stable-linux-amd64.zip && \
35
- ls -l && \
36
- mv ngrok $HOME/.local/bin && \
37
- ls -l $HOME/.local/bin && \
38
  rm ngrok-stable-linux-amd64.zip
39
 
 
 
 
 
 
 
40
  # Set permissions for ngrok
41
  RUN chmod +x $HOME/.local/bin/ngrok
42
 
@@ -44,9 +46,9 @@ RUN chmod +x $HOME/.local/bin/ngrok
44
  RUN mkdir -p $HOME/.ngrok2 && \
45
  echo "authtoken: 1XtU01EKWysplGQ8fz54lVUQpnQ_3KKhw6YNQ5E85rxdkgXx4" > $HOME/.ngrok2/ngrok.yml
46
 
47
- # Run the FastAPI application and ngrok
48
  CMD ["sh", "-c", "uvicorn app:app --host 0.0.0.0 --port 7860 & sleep 5 && ngrok http 7860"]
49
 
50
- # Expose the ports for FastAPI and ngrok's web interface
51
  EXPOSE 7860
52
  EXPOSE 4040
 
 
1
  FROM python:3.9
2
 
3
+ ARG DEBIAN_FRONTEND=noninteractive
4
+
5
  RUN apt-get update && apt-get install --no-install-recommends -y \
6
+ build-essential \
7
+ python3-pip \
8
+ git \
9
+ ffmpeg \
10
+ && apt-get clean && rm -rf /var/lib/apt/lists/*
11
 
 
12
  WORKDIR /code
13
 
 
14
  COPY ./requirements.txt /code/requirements.txt
15
+
16
+ # For hugging face
17
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
18
 
19
+ # Set up user and environment
20
  RUN useradd -m -u 1000 user
21
  USER user
 
 
22
  ENV HOME=/home/user \
23
  PATH=/home/user/.local/bin:$PATH
24
 
25
+ # Set working directory
26
  WORKDIR $HOME/app
27
 
28
  # Copy the application files into the container
 
31
  # Download and extract ngrok
32
  RUN wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip && \
33
  unzip ngrok-stable-linux-amd64.zip && \
 
 
 
34
  rm ngrok-stable-linux-amd64.zip
35
 
36
+ # Create the destination directory for ngrok binary
37
+ RUN mkdir -p $HOME/.local/bin
38
+
39
+ # Move ngrok binary to destination directory
40
+ RUN mv ngrok $HOME/.local/bin/ngrok
41
+
42
  # Set permissions for ngrok
43
  RUN chmod +x $HOME/.local/bin/ngrok
44
 
 
46
  RUN mkdir -p $HOME/.ngrok2 && \
47
  echo "authtoken: 1XtU01EKWysplGQ8fz54lVUQpnQ_3KKhw6YNQ5E85rxdkgXx4" > $HOME/.ngrok2/ngrok.yml
48
 
49
+ # Set the command to run the FastAPI application and ngrok
50
  CMD ["sh", "-c", "uvicorn app:app --host 0.0.0.0 --port 7860 & sleep 5 && ngrok http 7860"]
51
 
52
+ # Expose the port for ngrok and FastAPI
53
  EXPOSE 7860
54
  EXPOSE 4040