Dockerfile 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. FROM selenium/node-chrome
  2. ARG G4F_VERSION
  3. ENV G4F_VERSION $G4F_VERSION
  4. ENV SE_SCREEN_WIDTH 1850
  5. ENV G4F_DIR /app
  6. ENV G4F_LOGIN_URL http://localhost:7900/?autoconnect=1&resize=scale&password=secret
  7. USER root
  8. # If docker compose, install git
  9. RUN if [ "$G4F_VERSION" = "" ] ; then \
  10. apt-get -qqy update && \
  11. apt-get -qqy install git \
  12. ; fi
  13. # Install Python3, pip, remove OpenJDK 11, clean up
  14. RUN apt-get -qqy update \
  15. && apt-get -qqy upgrade \
  16. && apt-get -qyy autoremove \
  17. && apt-get -qqy install python3 python-is-python3 pip \
  18. && apt-get -qyy remove openjdk-11-jre-headless \
  19. && apt-get -qyy autoremove \
  20. && apt-get -qyy clean \
  21. && rm -rf /var/lib/apt/lists/* /var/cache/apt/*
  22. # Update entrypoint
  23. COPY docker/supervisor.conf /etc/supervisor/conf.d/selenium.conf
  24. COPY docker/supervisor-api.conf /etc/supervisor/conf.d/api.conf
  25. # Change background image
  26. COPY docker/background.png /usr/share/images/fluxbox/ubuntu-light.png
  27. # Add user, fix permissions
  28. RUN chown "${SEL_UID}:${SEL_GID}" $HOME/.local
  29. # Switch user
  30. USER $SEL_UID
  31. # Set the working directory in the container.
  32. WORKDIR $G4F_DIR
  33. # Copy the project's requirements file into the container.
  34. COPY requirements.txt $G4F_DIR
  35. # Upgrade pip for the latest features and install the project's Python dependencies.
  36. RUN pip install --break-system-packages --upgrade pip \
  37. && pip install --break-system-packages -r requirements.txt
  38. # Copy the entire package into the container.
  39. ADD --chown=$SEL_UID:$SEL_GID g4f $G4F_DIR/g4f
  40. # Expose ports
  41. EXPOSE 8080 7900