CoolFace
Apppublic

cofaideveloper/chat.server

sourceHugging Faceupdated 3y agoView on Hugging Face
0likes
Dockerfile133 linesDownload Raw Back to root
1# Use the official Python 3.9 image as the base image2FROM python:3.93 4# Expose the port5EXPOSE 78606 7# Keeps Python from generating .pyc files in the container8ENV PYTHONDONTWRITEBYTECODE=19 10# Turns off buffering for easier container logging11ENV PYTHONUNBUFFERED=112 13# Set the PYNGROK_CONFIG environment variable14ENV PYNGROK_CONFIG /tmp/pyngrok.yml15 16# Set the NGROK_PATH environment variable to a writable location17ENV NGROK_PATH /tmp/ngrok18 19# Copy requirements.txt into the container20COPY requirements.txt .21 22# RUN apt-get update 23# RUN apt-get install -y wget24# RUN wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb25# RUN apt-get install ./google-chrome-stable_current_amd64.deb -y26 27 28# RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -29# RUN sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'30# RUN apt-get -y update31# RUN apt-get install -y google-chrome-stable32 33# # install chromedriver34# RUN apt-get install -yqq unzip35# RUN wget -O /tmp/chromedriver.zip http://chromedriver.storage.googleapis.com/`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`/chromedriver_linux64.zip36# RUN unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/37 38 39 40 41 42# RUN apt install wget -y43# RUN wget https://github.com/mozilla/geckodriver/releases/download/v0.32.0/geckodriver-v0.32.0-linux64.tar.gz44# RUN tar -xzvf geckodriver-v0.32.0-linux64.tar.gz -C /usr/local/bin45# RUN chmod +x /usr/local/bin/geckodriver46# RUN geckodriver -V47 48 49# RUN apt install firefox-esr -y50# RUN apt-get install firefox-geckodriver51 52# Upgrade pip and install the required packages53RUN pip install --upgrade pip && \54    pip install -r requirements.txt55 56# Install sudo and create the necessary directories before copying the files57RUN apt-get update && \58    apt-get install -y sudo && \59    mkdir -p /code/image60 61# Creates a non-root user with an explicit UID and adds permission to access the /code folder62RUN adduser -u 5678 --disabled-password --gecos "" appuser && \63    usermod -aG sudo appuser && \64    usermod -aG root appuser && \65    chown -R appuser:appuser /code66 67# Create the pyngrok bin directory and set the ownership and permissions for appuser68RUN mkdir -p /usr/local/lib/python3.9/site-packages/pyngrok/bin && \69    chown -R appuser:appuser /usr/local/lib/python3.9/site-packages/pyngrok/bin && \70    chmod -R 777 /usr/local/lib/python3.9/site-packages/pyngrok/bin71 72RUN mkdir -p /.ngrok2 && \73    chown -R appuser:appuser /.ngrok2 && \74    chmod -R 777 /.ngrok275 76RUN apt-get update && \77    apt-get install -y curl78 79RUN echo "deb http://deb.debian.org/debian/ unstable main contrib non-free" >> /etc/apt/sources.list.d/debian.list80 81 82# RUN apt install firefox-esr && \83#     apt install geckodriver84 85# Set the working directory and copy the files86WORKDIR /code87 88# Set the ownership and permissions for the /code directory and its contents89RUN chown -R appuser:appuser /code && \90    chmod -R 777 /code91 92COPY . /code93 94# RUN chown -R appuser:appuser /code/data.csv && \95#     chmod -R 777 /code/data.csv96 97# Copy the pyngrok.yml configuration file98COPY pyngrok.yml /tmp/pyngrok.yml99 100# Set the TRANSFORMERS_CACHE environment variable to a cache directory inside /tmp101ENV TRANSFORMERS_CACHE /tmp/transformers_cache102ENV TORCH_HOME /tmp/torch_cache103 104USER appuser105 106 107RUN git clone https://github.com/rphrp1985/gpt4f108# WORKDIR /gpt4f109# COPY . /gpt4f110# RUN cd gpt4f111# RUN ls112 113# cp -R / /root/dest-folder114RUN cp -R gpt4f/* /code115RUN ls116CMD python run.py117 118 119 120 121 122 123 124# Start the application using pyngrok125# CMD python main.py126# Get the public IP address and display it127# RUN curl -s https://api.ipify.org | xargs echo "Public IP:"128RUN pip install gunicorn129 130# Start the Uvicorn server131# ENTRYPOINT ["python", "main.py"]132# CMD ["sh", "-c", "python main.py & sleep infinity"]133CMD ["gunicorn", "--bind",  "0.0.0.0:7860","run:app"]