Dockerfile 1.4 KB

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