Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +16 -37
Dockerfile
CHANGED
@@ -1,43 +1,22 @@
|
|
1 |
-
FROM
|
2 |
|
3 |
ARG G4F_API_KEY
|
4 |
ARG G4F_IGNORED_PROVIDERS
|
5 |
-
ENV G4F_DIR /app
|
6 |
-
ENV SE_SCREEN_WIDTH 1850
|
7 |
|
8 |
-
|
9 |
-
USER root
|
10 |
WORKDIR /app
|
11 |
|
12 |
-
|
13 |
-
RUN
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|