Spaces:
Nakdesu
/
Runtime error

Nakdesu commited on
Commit
90c2226
·
verified ·
1 Parent(s): 953753f

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -19
Dockerfile CHANGED
@@ -5,35 +5,33 @@ ARG G4F_IGNORED_PROVIDERS
5
  ENV G4F_DIR /app
6
  ENV SE_SCREEN_WIDTH 1850
7
 
 
8
  USER root
9
  WORKDIR /app
 
 
10
  RUN chmod -R 777 /app
11
  COPY requirements.txt /app
12
 
13
  ENV HOME=/app
 
14
 
15
  RUN apt-get -qqy update \
16
- && apt-get -qqy upgrade \
17
- && apt-get -qqy autoremove \
18
- && apt-get -qqy install python3 git curl ca-certificates openssl libssl-dev python-is-python3 pip \
19
- && apt-get -qqy remove openjdk-11-jre-headless \
20
- && apt-get -qyy autoremove \
21
- && apt-get -qqy clean \
22
- && rm -rf /var/lib/apt/lists/* /var/cache/apt/*
23
 
24
  RUN pip install --break-system-packages --no-cache-dir --upgrade -r requirements.txt
25
 
26
- # Solution 1: Copy with permissions (if the directory exists during build)
27
- COPY har_and_cookies /app/har_and_cookies
28
 
29
- # Solution 2: Ensure directory exists and change ownership (useful for volume mounts)
30
- RUN mkdir -p /app/har_and_cookies
31
- RUN chown -R root:root /app/har_and_cookies
32
 
33
- # Solution 3: Change permissions (as a fallback or if initial permissions are restrictive)
34
- RUN chmod -R a+r /app/har_and_cookies
35
-
36
- ENV G4F_API_KEY $G4F_API_KEY
37
- ENV G4F_IGNORED_PROVIDERS $G4F_IGNORED_PROVIDERS
38
-
39
- CMD python -m g4f --port 7860 --debug --ignored-providers $G4F_IGNORED_PROVIDERS
 
5
  ENV G4F_DIR /app
6
  ENV SE_SCREEN_WIDTH 1850
7
 
8
+ # RUN useradd -m -u 1000 user # Keep this commented unless you set up a non-root user
9
  USER root
10
  WORKDIR /app
11
+ # Note: chmod 777 on /app before copying isn't strictly necessary if running as root,
12
+ # but doesn't hurt. It won't fix permissions for files copied later if not owned by the running user.
13
  RUN chmod -R 777 /app
14
  COPY requirements.txt /app
15
 
16
  ENV HOME=/app
17
+ #PATH=/home/user/.local/bin:$PATH
18
 
19
  RUN apt-get -qqy update \
20
+ && apt-get -qqy upgrade \
21
+ && apt-get -qyy autoremove \
22
+ && apt-get -qqy install python3 git curl ca-certificates openssl libssl-dev python-is-python3 pip \
23
+ && apt-get -qyy remove openjdk-11-jre-headless \
24
+ && apt-get -qyy autoremove \
25
+ && apt-get -qyy clean \
26
+ && rm -rf /var/lib/apt/lists/* /var/cache/apt/*
27
 
28
  RUN pip install --break-system-packages --no-cache-dir --upgrade -r requirements.txt
29
 
30
+ # This is the critical fix: Copy the application code, including har_and_cookies
31
+ COPY . /app
32
 
33
+ ENV G4F_API_KEY ${G4F_API_KEY}
34
+ ENV G4F_IGNORED_PROVIDERS ${G4F_IGNORED_PROVIDERS}
 
35
 
36
+ # Use ENV vars within the CMD or ENTRYPOINT
37
+ CMD python -m g4f --port 7860 --debug --ignored-providers ${G4F_IGNORED_PROVIDERS}