g4f0204 / Dockerfile
mfoud444's picture
app1
3bbe00e
raw
history blame contribute delete
No virus
3.58 kB
# FROM selenium/node-chrome
# ARG G4F_VERSION
# ARG G4F_USER=g4f
# ARG G4F_USER_ID=1000
# ARG G4F_NO_GUI
# ARG G4F_PASS=secret
# ENV G4F_VERSION $G4F_VERSION
# ENV G4F_USER $G4F_USER
# ENV G4F_USER_ID $G4F_USER_ID
# ENV G4F_NO_GUI $G4F_NO_GUI
# ENV SE_SCREEN_WIDTH 1850
# ENV PYTHONUNBUFFERED 1
# ENV G4F_DIR /app
# ENV G4F_LOGIN_URL http://localhost:7900/?autoconnect=1&resize=scale&password=$G4F_PASS
# ENV HOME /home/$G4F_USER
# ENV PATH $PATH:$HOME/.local/bin
# ENV SE_DOWNLOAD_DIR $HOME/Downloads
# ENV SEL_USER $G4F_USER
# ENV SEL_UID $G4F_USER_ID
# ENV SEL_GID $G4F_USER_ID
# USER root
# # If docker compose, install git
# RUN if [ "$G4F_VERSION" = "" ] ; then \
# apt-get -qqy update && \
# apt-get -qqy install git \
# ; fi
# # Python packages
# RUN apt-get -qqy update \
# && apt-get -qqy install \
# python3 \
# python-is-python3 \
# pip
# # Remove java
# RUN apt-get -qyy remove openjdk-11-jre-headless
# # Cleanup
# RUN rm -rf /var/lib/apt/lists/* /var/cache/apt/* \
# && apt-get -qyy autoremove \
# && apt-get -qyy clean
# # Update entrypoint
# COPY docker/supervisor.conf /etc/supervisor/conf.d/selenium.conf
# COPY docker/supervisor-gui.conf /etc/supervisor/conf.d/gui.conf
# # If no gui
# RUN if [ "$G4F_NO_GUI" ] ; then \
# rm /etc/supervisor/conf.d/gui.conf \
# ; fi
# # Change background image
# COPY docker/background.png /usr/share/images/fluxbox/ubuntu-light.png
# # Add user
# RUN groupadd -g $G4F_USER_ID $G4F_USER \
# && useradd -rm -G sudo -u $G4F_USER_ID -g $G4F_USER_ID $G4F_USER \
# && echo "${G4F_USER}:${G4F_PASS}" | chpasswd
# # Fix permissions
# RUN mkdir "${SE_DOWNLOAD_DIR}"
# RUN chown "${G4F_USER_ID}:${G4F_USER_ID}" $SE_DOWNLOAD_DIR /var/run/supervisor /var/log/supervisor
# RUN chown "${G4F_USER_ID}:${G4F_USER_ID}" -R /opt/bin/ /usr/bin/chromedriver /opt/selenium/
# # Switch user
# USER $G4F_USER_ID
# # Set VNC password
# RUN mkdir -p ${HOME}/.vnc \
# && x11vnc -storepasswd ${G4F_PASS} ${HOME}/.vnc/passwd
# # Set the working directory in the container.
# WORKDIR $G4F_DIR
# # Copy the project's requirements file into the container.
# COPY requirements.txt $G4F_DIR
# COPY s.py $G4F_DIR
# # Upgrade pip for the latest features and install the project's Python dependencies.
# RUN pip install --upgrade pip && pip install -r requirements.txt
# # Copy the entire package into the container.
# ADD --chown=$G4F_USER:$G4F_USER g4f $G4F_DIR/g4f
# RUN ls
# RUN chromedriver --version
# RUN which chromedriver
# RUN ls
# RUN ls
# RUN python s.py
# # Expose ports
# EXPOSE 80 7860
FROM python:3.10.2-bullseye
RUN apt-get update -y
# We need wget to set up the PPA and xvfb to have a virtual screen and unzip to install the Chromedriver
RUN apt-get install -y wget xvfb unzip
# Set up the Chrome PPA
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
RUN echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list
# Update the package list and install chrome
RUN apt-get update -y
RUN apt-get install -y google-chrome-stable
# Set up Chromedriver Environment variables
ENV CHROMEDRIVER_VERSION 97.0.4692.71
ENV CHROMEDRIVER_DIR /chromedriver
RUN mkdir $CHROMEDRIVER_DIR
# Download and install Chromedriver
RUN wget -q --continue -P $CHROMEDRIVER_DIR "http://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip"
RUN unzip $CHROMEDRIVER_DIR/chromedriver* -d $CHROMEDRIVER_DIR
# Put Chromedriver into the PATH
ENV PATH $CHROMEDRIVER_DIR:$PATH
COPY s.py .
RUN ls
RUN python s.py