Mohammed Foud
commited on
Commit
·
2b897f4
1
Parent(s):
ac3f3ee
Add application file
Browse files- Dockerfile +12 -5
Dockerfile
CHANGED
|
@@ -5,6 +5,7 @@ FROM python:3.10-slim
|
|
| 5 |
ENV PORT=7860
|
| 6 |
ENV SHM_SIZE="1g"
|
| 7 |
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
| 8 |
WORKDIR /app
|
| 9 |
|
| 10 |
# Create a non-root user and switch to it
|
|
@@ -12,10 +13,13 @@ RUN useradd -m -u 1000 user && \
|
|
| 12 |
mkdir -p /app/har_and_cookies /app/generated_media && \
|
| 13 |
chown -R user:user /app
|
| 14 |
|
| 15 |
-
# Install required system dependencies
|
| 16 |
RUN apt-get update && \
|
| 17 |
apt-get install -y --no-install-recommends \
|
| 18 |
wget \
|
|
|
|
|
|
|
|
|
|
| 19 |
&& rm -rf /var/lib/apt/lists/*
|
| 20 |
|
| 21 |
# Switch to the non-root user
|
|
@@ -26,8 +30,11 @@ ENV PATH="/home/user/.local/bin:${PATH}"
|
|
| 26 |
RUN pip install --no-cache-dir --user \
|
| 27 |
uvicorn \
|
| 28 |
fastapi \
|
| 29 |
-
hypercorn
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
| 31 |
# Ensure proper Python path configuration
|
| 32 |
ENV PYTHONPATH="${PYTHONPATH}:/home/user/.local/lib/python3.10/site-packages"
|
| 33 |
|
|
@@ -38,5 +45,5 @@ RUN mkdir -p /app/har_and_cookies /app/generated_media && \
|
|
| 38 |
# Expose the required port
|
| 39 |
EXPOSE 7860
|
| 40 |
|
| 41 |
-
# Correct command to run the application
|
| 42 |
-
CMD ["sh", "-c", "python -m g4f.cli api --bind 0.0.0.0:$PORT"]
|
|
|
|
| 5 |
ENV PORT=7860
|
| 6 |
ENV SHM_SIZE="1g"
|
| 7 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 8 |
+
|
| 9 |
WORKDIR /app
|
| 10 |
|
| 11 |
# Create a non-root user and switch to it
|
|
|
|
| 13 |
mkdir -p /app/har_and_cookies /app/generated_media && \
|
| 14 |
chown -R user:user /app
|
| 15 |
|
| 16 |
+
# Install required system dependencies including SSL libraries
|
| 17 |
RUN apt-get update && \
|
| 18 |
apt-get install -y --no-install-recommends \
|
| 19 |
wget \
|
| 20 |
+
ca-certificates \
|
| 21 |
+
libssl-dev \
|
| 22 |
+
&& apt-get clean \
|
| 23 |
&& rm -rf /var/lib/apt/lists/*
|
| 24 |
|
| 25 |
# Switch to the non-root user
|
|
|
|
| 30 |
RUN pip install --no-cache-dir --user \
|
| 31 |
uvicorn \
|
| 32 |
fastapi \
|
| 33 |
+
hypercorn \
|
| 34 |
+
g4f[all] \
|
| 35 |
+
pyopenssl \
|
| 36 |
+
cryptography
|
| 37 |
+
|
| 38 |
# Ensure proper Python path configuration
|
| 39 |
ENV PYTHONPATH="${PYTHONPATH}:/home/user/.local/lib/python3.10/site-packages"
|
| 40 |
|
|
|
|
| 45 |
# Expose the required port
|
| 46 |
EXPOSE 7860
|
| 47 |
|
| 48 |
+
# Correct command to run the application with limited providers and debug mode
|
| 49 |
+
CMD ["sh", "-c", "python -m g4f.cli api --bind 0.0.0.0:$PORT --debug --disable-proxy"]
|