rishikumar20202023 commited on
Commit
ac8a3b2
·
verified ·
1 Parent(s): 9858ab2

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +34 -24
Dockerfile CHANGED
@@ -1,43 +1,53 @@
1
  FROM selenium/node-chrome
2
 
3
- # Arguments and environment variables
4
  ARG G4F_VERSION
5
  ENV G4F_VERSION $G4F_VERSION
 
6
  ENV SE_SCREEN_WIDTH 1850
7
  ENV G4F_DIR /app
8
  ENV G4F_LOGIN_URL http://localhost:7900/?autoconnect=1&resize=scale&password=secret
9
 
10
- # Create a non-root user
11
- RUN useradd -m -u 1000 user
12
 
13
- # Install required packages
 
 
 
 
 
 
 
 
 
14
  RUN apt-get -qqy update \
15
- && apt-get -qqy upgrade \
16
- && apt-get -qyy install git python3 python-is-python3 pip \
17
- && apt-get -qyy remove openjdk-11-jre-headless \
18
- && apt-get -qyy autoremove \
19
- && apt-get -qyy clean \
20
- && rm -rf /var/lib/apt/lists/* /var/cache/apt/*
21
-
22
- # Set working directory
23
- WORKDIR /app
24
 
25
- # Ensure permissions for the non-root user
26
- RUN chown -R user:user /app
27
  RUN chmod -R 777 /app
28
 
29
- # Switch to the non-root user
30
- USER user
31
 
32
- # Install Python dependencies
33
  COPY requirements.txt /app
 
 
34
  RUN pip install --break-system-packages -r requirements.txt
35
 
36
- # Copy the project files with permissions
37
- COPY --chown=user:user . /app
38
 
39
- # Expose the port if needed
40
- EXPOSE 7860
 
 
 
 
41
 
42
- # Run the app
43
- CMD ["python", "-m", "g4f", "--port", "7860", "--debug"]
 
1
  FROM selenium/node-chrome
2
 
3
+
4
  ARG G4F_VERSION
5
  ENV G4F_VERSION $G4F_VERSION
6
+
7
  ENV SE_SCREEN_WIDTH 1850
8
  ENV G4F_DIR /app
9
  ENV G4F_LOGIN_URL http://localhost:7900/?autoconnect=1&resize=scale&password=secret
10
 
 
 
11
 
12
+ # RUN useradd -m -u 1000 user
13
+ USER root
14
+ # ENV PATH="/home/user/.local/bin:$PATH"
15
+ # # ^ when run as `user`, pip installs executables there
16
+
17
+ RUN if [ "$G4F_VERSION" = "" ] ; then \
18
+ apt-get -qqy update && \
19
+ apt-get -qqy install git \
20
+ ; fi
21
+
22
  RUN apt-get -qqy update \
23
+ && apt-get -qqy upgrade \
24
+ && apt-get -qyy autoremove \
25
+ && apt-get -qqy install python3 python-is-python3 pip \
26
+ && apt-get -qyy remove openjdk-11-jre-headless \
27
+ && apt-get -qyy autoremove \
28
+ && apt-get -qyy clean \
29
+ && rm -rf /var/lib/apt/lists/* /var/cache/apt/*
30
+
31
+
32
 
33
+
34
+ # RUN chown "${SEL_UID}:${SEL_GID}" $HOME/.local
35
  RUN chmod -R 777 /app
36
 
37
+ WORKDIR /app
38
+
39
 
 
40
  COPY requirements.txt /app
41
+
42
+
43
  RUN pip install --break-system-packages -r requirements.txt
44
 
 
 
45
 
46
+ # COPY --chown=user ./requirements.txt requirements.txt
47
+ # RUN pip install --no-cache-dir --upgrade -r requirements.txt
48
+
49
+ # ADD --chown=$SEL_UID:$SEL_GID g4f $G4F_DIR/g4f
50
+
51
+ # COPY --chown=user . /app
52
 
53
+ CMD ["python", "-m", "g4f" ,"--port" ,"7860", "--debug"]