rishi1985 commited on
Commit
d2174db
1 Parent(s): 90e98b8

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +29 -25
Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
  # Use the official Python 3.9 image as the base image
2
- FROM python:3.9
3
 
4
  # Expose the port
5
  EXPOSE 7860
@@ -16,6 +16,8 @@ ENV PYNGROK_CONFIG /tmp/pyngrok.yml
16
  # Set the NGROK_PATH environment variable to a writable location
17
  ENV NGROK_PATH /tmp/ngrok
18
 
 
 
19
  # Copy requirements.txt into the container
20
  COPY requirements.txt .
21
 
@@ -32,33 +34,21 @@ RUN apt-get install -y google-chrome-stable
32
 
33
  # install chromedriver
34
  RUN apt-get install -yqq unzip
35
- RUN wget -O /tmp/chromedriver.zip http://chromedriver.storage.googleapis.com/`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`/chromedriver_linux64.zip
36
- RUN unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
 
47
 
48
 
49
 
 
 
 
 
 
50
 
51
-
52
-
53
-
54
- # RUN apt install wget -y
55
- # RUN wget https://github.com/mozilla/geckodriver/releases/download/v0.32.0/geckodriver-v0.32.0-linux64.tar.gz
56
- # RUN tar -xzvf geckodriver-v0.32.0-linux64.tar.gz -C /usr/local/bin
57
- # RUN chmod +x /usr/local/bin/geckodriver
58
- # RUN geckodriver -V
59
-
60
-
61
- # RUN apt install firefox-esr -y
62
  # RUN apt-get install firefox-geckodriver
63
 
64
  # Upgrade pip and install the required packages
@@ -70,6 +60,14 @@ RUN apt-get update && \
70
  apt-get install -y sudo && \
71
  mkdir -p /code/image
72
 
 
 
 
 
 
 
 
 
73
  # Creates a non-root user with an explicit UID and adds permission to access the /code folder
74
  RUN adduser -u 5678 --disabled-password --gecos "" appuser && \
75
  usermod -aG sudo appuser && \
@@ -85,6 +83,9 @@ RUN mkdir -p /.ngrok2 && \
85
  chown -R appuser:appuser /.ngrok2 && \
86
  chmod -R 777 /.ngrok2
87
 
 
 
 
88
  RUN apt-get update && \
89
  apt-get install -y curl
90
 
@@ -113,7 +114,7 @@ COPY pyngrok.yml /tmp/pyngrok.yml
113
  ENV TRANSFORMERS_CACHE /tmp/transformers_cache
114
  ENV TORCH_HOME /tmp/torch_cache
115
 
116
- USER appuser
117
 
118
  # Start the application using pyngrok
119
  # CMD python main.py
@@ -121,7 +122,10 @@ USER appuser
121
  RUN curl -s https://api.ipify.org | xargs echo "Public IP:"
122
  RUN pip install gunicorn
123
 
 
 
124
  # Start the Uvicorn server
125
  # ENTRYPOINT ["python", "main.py"]
126
  # CMD ["sh", "-c", "python main.py & sleep infinity"]
127
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
1
  # Use the official Python 3.9 image as the base image
2
+ FROM python:3.11
3
 
4
  # Expose the port
5
  EXPOSE 7860
 
16
  # Set the NGROK_PATH environment variable to a writable location
17
  ENV NGROK_PATH /tmp/ngrok
18
 
19
+
20
+
21
  # Copy requirements.txt into the container
22
  COPY requirements.txt .
23
 
 
34
 
35
  # install chromedriver
36
  RUN apt-get install -yqq unzip
37
+ RUN wget -O /tmp/chromedriver-linux64.zip https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/119.0.6045.105/linux64/chromedriver-linux64.zip
38
+ RUN unzip /tmp/chromedriver-linux64.zip chromedriver-linux64/chromedriver -d /usr/local/bin/
 
 
 
 
 
 
 
 
 
39
 
40
 
41
 
42
 
43
+ RUN apt install wget -y
44
+ RUN wget https://github.com/mozilla/geckodriver/releases/download/v0.32.0/geckodriver-v0.32.0-linux64.tar.gz
45
+ RUN tar -xzvf geckodriver-v0.32.0-linux64.tar.gz -C /usr/local/bin
46
+ RUN chmod +x /usr/local/bin/geckodriver
47
+ RUN geckodriver -V
48
 
49
+ # RUN add-apt-repository p?pa:mozillateam/ppa -y
50
+ RUN apt install firefox-esr -y
51
+ RUN which firefox-esr
 
 
 
 
 
 
 
 
52
  # RUN apt-get install firefox-geckodriver
53
 
54
  # Upgrade pip and install the required packages
 
60
  apt-get install -y sudo && \
61
  mkdir -p /code/image
62
 
63
+ RUN apt-get install -y socat
64
+
65
+ # RUN socat TCP-LISTEN:8888,fork PROXY:your-auth-proxy-server:proxy-port,proxyauth=user:pa
66
+ # RUN socat TCP-LISTEN:8888,fork PROXY:http://p.webshare.io:80,proxyauth=hnbynugo-rotate:2491y5ds75e7 &
67
+ RUN nohup socat TCP-LISTEN:8888,fork PROXY:http://p.webshare.io:80,proxyauth=hnbynugo-rotate:2491y5ds75e7 > socat.log 2>&1 &
68
+ # RUN socat TCP-LISTEN:8888,fork PROXY:http://p.webshare.io:80,proxyauth=hnbynugo-rotate:2491y5ds75e7
69
+
70
+
71
  # Creates a non-root user with an explicit UID and adds permission to access the /code folder
72
  RUN adduser -u 5678 --disabled-password --gecos "" appuser && \
73
  usermod -aG sudo appuser && \
 
83
  chown -R appuser:appuser /.ngrok2 && \
84
  chmod -R 777 /.ngrok2
85
 
86
+ RUN mkdir /.local
87
+ RUN chmod -R 777 /.local
88
+
89
  RUN apt-get update && \
90
  apt-get install -y curl
91
 
 
114
  ENV TRANSFORMERS_CACHE /tmp/transformers_cache
115
  ENV TORCH_HOME /tmp/torch_cache
116
 
117
+ # USER appuser
118
 
119
  # Start the application using pyngrok
120
  # CMD python main.py
 
122
  RUN curl -s https://api.ipify.org | xargs echo "Public IP:"
123
  RUN pip install gunicorn
124
 
125
+
126
+
127
  # Start the Uvicorn server
128
  # ENTRYPOINT ["python", "main.py"]
129
  # CMD ["sh", "-c", "python main.py & sleep infinity"]
130
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860","--workers","2"]
131
+ # CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]