guydffdsdsfd commited on
Commit
5afe169
·
verified ·
1 Parent(s): 9afcaa5

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -15
Dockerfile CHANGED
@@ -1,39 +1,34 @@
1
  # Use an official PyTorch image with CUDA support
2
  FROM pytorch/pytorch:2.1.0-cuda12.1-cudnn8-runtime
3
 
4
- # Set environment variables
5
- ENV PYTHONUNBUFFERED=1 \
 
 
6
  GRADIO_ALLOW_FLAGGING=never \
7
- GRADIO_NUM_PORTS=1 \
8
  GRADIO_SERVER_NAME="0.0.0.0" \
9
- GRADIO_THEME=huggingface \
10
  HOME=/home/user
11
 
12
- # Install system dependencies
13
  RUN apt-get update && apt-get install -y \
 
14
  git \
15
  libgl1-mesa-glx \
16
  libglib2.0-0 \
17
  && rm -rf /var/lib/apt/lists/*
18
 
19
- # Create a non-root user
20
  RUN useradd -m -u 1000 user
21
  USER user
22
  WORKDIR $HOME/app
23
 
24
- # Copy requirements and install
25
- # (Assuming you have a requirements.txt with diffusers, transformers, accelerate, gradio)
26
  COPY --chown=user requirements.txt .
27
  RUN pip install --no-cache-dir -r requirements.txt
28
 
29
- # Copy the rest of the application
30
  COPY --chown=user . .
31
 
32
- # Make the startup script executable
33
  RUN chmod +x start.sh
34
-
35
- # Expose the port Gradio runs on
36
- EXPOSE 7860
37
-
38
- # Run the startup script
39
  CMD ["./start.sh"]
 
1
  # Use an official PyTorch image with CUDA support
2
  FROM pytorch/pytorch:2.1.0-cuda12.1-cudnn8-runtime
3
 
4
+ # 1. Fix the "Time Zone" hang: Set to non-interactive and default to UTC
5
+ ENV DEBIAN_FRONTEND=noninteractive \
6
+ TZ=Etc/UTC \
7
+ PYTHONUNBUFFERED=1 \
8
  GRADIO_ALLOW_FLAGGING=never \
 
9
  GRADIO_SERVER_NAME="0.0.0.0" \
 
10
  HOME=/home/user
11
 
12
+ # 2. Install system dependencies (tzdata is installed silently now)
13
  RUN apt-get update && apt-get install -y \
14
+ tzdata \
15
  git \
16
  libgl1-mesa-glx \
17
  libglib2.0-0 \
18
  && rm -rf /var/lib/apt/lists/*
19
 
20
+ # 3. Set up the Hugging Face User (Required for Spaces)
21
  RUN useradd -m -u 1000 user
22
  USER user
23
  WORKDIR $HOME/app
24
 
25
+ # 4. Install Python dependencies
 
26
  COPY --chown=user requirements.txt .
27
  RUN pip install --no-cache-dir -r requirements.txt
28
 
29
+ # 5. Copy the rest of your code
30
  COPY --chown=user . .
31
 
32
+ # 6. Make start script executable and launch
33
  RUN chmod +x start.sh
 
 
 
 
 
34
  CMD ["./start.sh"]