Spaces:
Runtime error
Runtime error
fix: correct Dockerfile formatting and structure
Browse files- Dockerfile +31 -9
Dockerfile
CHANGED
@@ -1,31 +1,53 @@
|
|
1 |
-
RUN echo "Acquire::Retries "3";" > /etc/apt/apt.conf.d/80-retries
|
2 |
-
|
3 |
-
# Clean and update package lists
|
4 |
-
RUN rm -rf /var/lib/apt/lists/* && apt-get clean && apt-get update --fix-missing
|
5 |
-
|
6 |
FROM nvidia/cuda:11.7.1-cudnn8-devel-ubuntu20.04
|
7 |
|
8 |
ENV DEBIAN_FRONTEND=noninteractive
|
9 |
-
RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing git python3-pip python3-dev ffmpeg libsm6 libxext6 && rm -rf /var/lib/apt/lists/*
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
RUN useradd -m -u 1000 user
|
12 |
USER user
|
13 |
|
14 |
-
|
|
|
|
|
|
|
15 |
|
16 |
-
|
|
|
17 |
|
|
|
18 |
COPY --chown=user . .
|
19 |
|
|
|
20 |
RUN pip install --no-cache-dir -r requirements.txt
|
21 |
RUN pip install --no-cache-dir gradio==4.12 spaces cuid huggingface_hub
|
22 |
|
|
|
23 |
USER root
|
24 |
RUN mkdir -p /data && chown -R user:user /data
|
25 |
USER user
|
26 |
|
27 |
-
WORKDIR /
|
28 |
|
|
|
29 |
EXPOSE 7860
|
30 |
|
|
|
31 |
CMD ["python", "app_gradio_space.py"]
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
FROM nvidia/cuda:11.7.1-cudnn8-devel-ubuntu20.04
|
2 |
|
3 |
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
4 |
|
5 |
+
# Add retry logic for apt-get
|
6 |
+
RUN echo 'Acquire::Retries "3";' > /etc/apt/apt.conf.d/80-retries
|
7 |
+
|
8 |
+
# Clean and update package lists
|
9 |
+
RUN rm -rf /var/lib/apt/lists/* && \
|
10 |
+
apt-get clean && \
|
11 |
+
apt-get update --fix-missing
|
12 |
+
|
13 |
+
# Install system dependencies with retry logic
|
14 |
+
RUN apt-get install -y --no-install-recommends --fix-missing \
|
15 |
+
git \
|
16 |
+
python3-pip \
|
17 |
+
python3-dev \
|
18 |
+
ffmpeg \
|
19 |
+
libsm6 \
|
20 |
+
libxext6 \
|
21 |
+
&& rm -rf /var/lib/apt/lists/*
|
22 |
+
|
23 |
+
# Set up a new user named "user" with user ID 1000
|
24 |
RUN useradd -m -u 1000 user
|
25 |
USER user
|
26 |
|
27 |
+
# Set home to the user's home directory
|
28 |
+
ENV HOME=/home/user \
|
29 |
+
PATH=/home/user/.local/bin:$PATH \
|
30 |
+
PYTHONPATH=/home/user/app:/home/user/app/MMCM:/home/user/app/diffusers/src:/home/user/app/controlnet_aux/src
|
31 |
|
32 |
+
# Set the working directory
|
33 |
+
WORKDIR $HOME/app
|
34 |
|
35 |
+
# Copy the application code
|
36 |
COPY --chown=user . .
|
37 |
|
38 |
+
# Install dependencies
|
39 |
RUN pip install --no-cache-dir -r requirements.txt
|
40 |
RUN pip install --no-cache-dir gradio==4.12 spaces cuid huggingface_hub
|
41 |
|
42 |
+
# Create data directory with correct permissions
|
43 |
USER root
|
44 |
RUN mkdir -p /data && chown -R user:user /data
|
45 |
USER user
|
46 |
|
47 |
+
WORKDIR $HOME/app/scripts/gradio
|
48 |
|
49 |
+
# Expose the port
|
50 |
EXPOSE 7860
|
51 |
|
52 |
+
# Start the Gradio app
|
53 |
CMD ["python", "app_gradio_space.py"]
|