Spaces:
Nakdesu
/
Running

Nakdesu commited on
Commit
c614e81
·
verified ·
1 Parent(s): ab909ff

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -37
Dockerfile CHANGED
@@ -1,43 +1,22 @@
1
- FROM selenium/node-chrome
2
 
3
  ARG G4F_API_KEY
4
  ARG G4F_IGNORED_PROVIDERS
5
- ENV G4F_DIR /app
6
- ENV SE_SCREEN_WIDTH 1850
7
 
8
- # Using root as specified
9
- USER root
10
  WORKDIR /app
11
 
12
- # Install system dependencies first
13
- RUN apt-get -qqy update \
14
- && apt-get -qqy upgrade \
15
- && apt-get -qyy autoremove \
16
- && apt-get -qqy install --no-install-recommends python3 git curl ca-certificates openssl libssl-dev 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
- # Copy requirements and install Python packages
23
- COPY requirements.txt /app/
24
- RUN pip install --break-system-packages --no-cache-dir --upgrade -r requirements.txt
25
-
26
- # Copy the entire application code
27
- COPY . /app
28
-
29
- # <<< FIX: Set ownership and permissions AFTER copying files >>>
30
- # Ensure the root user owns everything in /app and has write permissions
31
- RUN chown -R root:root /app \
32
- && chmod -R u+w /app
33
- # You could use chmod -R 777 /app, but u+w is sufficient for the owner (root)
34
-
35
- # Make sure the '>>> ' IS GONE from the start of this next line:
36
- ENV HOME=/app
37
- ENV G4F_API_KEY ${G4F_API_KEY}
38
- ENV G4F_IGNORED_PROVIDERS ${G4F_IGNORED_PROVIDERS}
39
-
40
- # Use ENV vars within the CMD or ENTRYPOINT
41
- # Expose the port the application runs on
42
- EXPOSE 7860
43
- CMD python -m g4f --port 7860 --debug --ignored-providers ${G4F_IGNORED_PROVIDERS}
 
1
+ FROM python:3.12
2
 
3
  ARG G4F_API_KEY
4
  ARG G4F_IGNORED_PROVIDERS
 
 
5
 
6
+ RUN useradd -m -u 1000 user
 
7
  WORKDIR /app
8
 
9
+ COPY --chown=user ./requirements.txt requirements.txt
10
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
11
+
12
+ COPY --chown=user . /app
13
+
14
+ USER user
15
+
16
+ ENV HOME=/home/user \
17
+ PATH=/home/user/.local/bin:$PATH
18
+
19
+ ENV G4F_API_KEY $G4F_API_KEY
20
+ ENV G4F_IGNORED_PROVIDERS $G4F_IGNORED_PROVIDERS
21
+
22
+ CMD python -m g4f --port 7860 --debug --ignored-providers $G4F_IGNORED_PROVIDERS