Mohammed Foud
commited on
Commit
·
bcaa0a6
1
Parent(s):
ff2059e
Add application file
Browse files- Dockerfile +14 -11
Dockerfile
CHANGED
|
@@ -5,28 +5,31 @@ FROM python:3.10-slim
|
|
| 5 |
ENV PORT=7860
|
| 6 |
ENV SHM_SIZE="1g"
|
| 7 |
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
# Install required system dependencies
|
| 10 |
RUN apt-get update && \
|
| 11 |
apt-get install -y --no-install-recommends \
|
| 12 |
wget \
|
| 13 |
-
xvfb \
|
| 14 |
-
x11vnc \
|
| 15 |
-
fluxbox \
|
| 16 |
&& rm -rf /var/lib/apt/lists/*
|
| 17 |
|
| 18 |
-
#
|
| 19 |
-
|
| 20 |
-
chown -R 1000:1000 /app/har_and_cookies /app/generated_media
|
| 21 |
|
| 22 |
# Install Python dependencies
|
| 23 |
-
RUN pip install --no-cache-dir g4f
|
| 24 |
|
| 25 |
-
#
|
| 26 |
-
|
|
|
|
| 27 |
|
| 28 |
-
#
|
| 29 |
-
|
| 30 |
|
| 31 |
# Command to run the application
|
| 32 |
CMD ["sh", "-c", "python -m g4f --debug --port $PORT"]
|
|
|
|
| 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
|
| 11 |
+
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
|
| 22 |
+
USER user
|
|
|
|
| 23 |
|
| 24 |
# Install Python dependencies
|
| 25 |
+
RUN pip install --no-cache-dir --user g4f
|
| 26 |
|
| 27 |
+
# Ensure the media directories exist with proper permissions
|
| 28 |
+
RUN mkdir -p /app/har_and_cookies /app/generated_media && \
|
| 29 |
+
chmod 755 /app/har_and_cookies /app/generated_media
|
| 30 |
|
| 31 |
+
# Expose the required port
|
| 32 |
+
EXPOSE 7860
|
| 33 |
|
| 34 |
# Command to run the application
|
| 35 |
CMD ["sh", "-c", "python -m g4f --debug --port $PORT"]
|