|
|
|
FROM python:3.11 |
|
|
|
|
|
EXPOSE 7860 |
|
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 |
|
|
|
|
|
ENV PYTHONUNBUFFERED=1 |
|
|
|
|
|
ENV PYNGROK_CONFIG /tmp/pyngrok.yml |
|
|
|
|
|
ENV NGROK_PATH /tmp/ngrok |
|
|
|
|
|
|
|
|
|
COPY requirements.txt . |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - |
|
RUN sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list' |
|
RUN apt-get -y update |
|
RUN apt-get install -y google-chrome-stable |
|
|
|
|
|
RUN apt-get install -yqq unzip |
|
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 |
|
RUN unzip /tmp/chromedriver-linux64.zip chromedriver-linux64/chromedriver -d /usr/local/bin/ |
|
|
|
|
|
|
|
|
|
RUN apt install wget -y |
|
RUN wget https://github.com/mozilla/geckodriver/releases/download/v0.32.0/geckodriver-v0.32.0-linux64.tar.gz |
|
RUN tar -xzvf geckodriver-v0.32.0-linux64.tar.gz -C /usr/local/bin |
|
RUN chmod +x /usr/local/bin/geckodriver |
|
RUN geckodriver -V |
|
|
|
|
|
RUN apt install firefox-esr -y |
|
RUN which firefox-esr |
|
|
|
|
|
|
|
RUN pip install --upgrade pip && \ |
|
pip install -r requirements.txt |
|
|
|
|
|
RUN apt-get update && \ |
|
apt-get install -y sudo && \ |
|
mkdir -p /code/image |
|
|
|
RUN apt-get install -y socat |
|
|
|
|
|
|
|
RUN nohup socat TCP-LISTEN:8888,fork PROXY:http://p.webshare.io:80,proxyauth=hnbynugo-rotate:2491y5ds75e7 > socat.log 2>&1 & |
|
|
|
|
|
|
|
|
|
RUN adduser -u 5678 --disabled-password --gecos "" appuser && \ |
|
usermod -aG sudo appuser && \ |
|
usermod -aG root appuser && \ |
|
chown -R appuser:appuser /code |
|
|
|
|
|
RUN mkdir -p /usr/local/lib/python3.9/site-packages/pyngrok/bin && \ |
|
chown -R appuser:appuser /usr/local/lib/python3.9/site-packages/pyngrok/bin && \ |
|
chmod -R 777 /usr/local/lib/python3.9/site-packages/pyngrok/bin |
|
|
|
RUN mkdir -p /.ngrok2 && \ |
|
chown -R appuser:appuser /.ngrok2 && \ |
|
chmod -R 777 /.ngrok2 |
|
|
|
RUN mkdir /.local |
|
RUN chmod -R 777 /.local |
|
|
|
RUN apt-get update && \ |
|
apt-get install -y curl |
|
|
|
RUN echo "deb http://deb.debian.org/debian/ unstable main contrib non-free" >> /etc/apt/sources.list.d/debian.list |
|
|
|
|
|
|
|
|
|
|
|
|
|
WORKDIR /code |
|
|
|
|
|
RUN chown -R appuser:appuser /code && \ |
|
chmod -R 777 /code |
|
|
|
COPY . /code |
|
|
|
|
|
|
|
|
|
|
|
COPY pyngrok.yml /tmp/pyngrok.yml |
|
|
|
|
|
ENV TRANSFORMERS_CACHE /tmp/transformers_cache |
|
ENV TORCH_HOME /tmp/torch_cache |
|
|
|
|
|
|
|
|
|
|
|
|
|
RUN curl -s https://api.ipify.org | xargs echo "Public IP:" |
|
RUN pip install gunicorn |
|
|
|
|
|
|
|
|
|
|
|
|
|
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860","--workers","1"] |
|
|