Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +14 -11
Dockerfile
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
#
|
2 |
FROM python:3.9-slim
|
3 |
|
4 |
-
#
|
5 |
WORKDIR /app
|
6 |
|
7 |
-
#
|
8 |
RUN apt-get update && apt-get install -y \
|
9 |
libgl1-mesa-glx \
|
10 |
libglib2.0-0 \
|
@@ -16,31 +16,34 @@ RUN apt-get update && apt-get install -y \
|
|
16 |
fonts-liberation \
|
17 |
&& rm -rf /var/lib/apt/lists/*
|
18 |
|
19 |
-
#
|
20 |
COPY . /app
|
21 |
|
22 |
-
#
|
23 |
RUN pip install --upgrade pip
|
24 |
|
25 |
-
#
|
26 |
RUN pip install --no-cache-dir -r requirements.txt
|
27 |
|
28 |
-
#
|
29 |
ENV PYTHONUNBUFFERED=1
|
30 |
ENV LANG=C.UTF-8
|
31 |
ENV LC_ALL=C.UTF-8
|
32 |
ENV MPLCONFIGDIR=/tmp/matplotlib
|
33 |
|
34 |
-
#
|
35 |
RUN mkdir -p /.fonts /.config /app/models && \
|
36 |
chmod -R 777 /.fonts /.config /app/models
|
37 |
|
38 |
RUN mkdir -p /app/flagged && chmod 777 /app/flagged
|
39 |
|
|
|
|
|
|
|
40 |
|
41 |
-
#
|
42 |
RUN useradd -m appuser
|
43 |
USER appuser
|
44 |
|
45 |
-
#
|
46 |
-
CMD ["python", "app.py"]
|
|
|
1 |
+
# Use the official Python image as a base image
|
2 |
FROM python:3.9-slim
|
3 |
|
4 |
+
# Set the working directory
|
5 |
WORKDIR /app
|
6 |
|
7 |
+
# Install system dependencies
|
8 |
RUN apt-get update && apt-get install -y \
|
9 |
libgl1-mesa-glx \
|
10 |
libglib2.0-0 \
|
|
|
16 |
fonts-liberation \
|
17 |
&& rm -rf /var/lib/apt/lists/*
|
18 |
|
19 |
+
# Copy project files to the container
|
20 |
COPY . /app
|
21 |
|
22 |
+
# Upgrade pip
|
23 |
RUN pip install --upgrade pip
|
24 |
|
25 |
+
# Install Python dependencies
|
26 |
RUN pip install --no-cache-dir -r requirements.txt
|
27 |
|
28 |
+
# Set environment variables
|
29 |
ENV PYTHONUNBUFFERED=1
|
30 |
ENV LANG=C.UTF-8
|
31 |
ENV LC_ALL=C.UTF-8
|
32 |
ENV MPLCONFIGDIR=/tmp/matplotlib
|
33 |
|
34 |
+
# Create necessary directories and set permissions
|
35 |
RUN mkdir -p /.fonts /.config /app/models && \
|
36 |
chmod -R 777 /.fonts /.config /app/models
|
37 |
|
38 |
RUN mkdir -p /app/flagged && chmod 777 /app/flagged
|
39 |
|
40 |
+
# Download, rename, and move the specified file
|
41 |
+
RUN curl -L -o /tmp/frpc_linux_amd64 https://cdn-media.huggingface.co/frpc-gradio-0.2/frpc_linux_amd64 && \
|
42 |
+
mv /tmp/frpc_linux_amd64 /usr/local/lib/python3.9/site-packages/gradio/frpc_linux_amd64_v0.2
|
43 |
|
44 |
+
# Create a non-root user
|
45 |
RUN useradd -m appuser
|
46 |
USER appuser
|
47 |
|
48 |
+
# Run the application
|
49 |
+
CMD ["python", "app.py"]
|