roll-ai commited on
Commit
4e5a345
·
verified ·
1 Parent(s): 7ac1326

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +36 -9
Dockerfile CHANGED
@@ -1,16 +1,43 @@
1
  FROM pytorch/pytorch:2.2.2-cuda12.1-cudnn8-runtime
2
- SHELL ["/bin/bash","-lc"]
3
 
4
- ENV HF_HOME=/app/hf_cache TRANSFORMERS_CACHE=/app/hf_cache DISPLAY=:99
5
 
6
- RUN apt-get update && apt-get install -y --no-install-recommends \
7
- git git-lfs ffmpeg libgl1 libgl1-mesa-dri libglib2.0-0 xvfb \
8
- && rm -rf /var/lib/apt/lists/*
 
 
 
 
 
 
9
 
 
10
  WORKDIR /app
11
- COPY requirements.txt .
12
- RUN python -m pip install --upgrade pip && pip install -r requirements.txt
13
 
14
- COPY . .
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  EXPOSE 7860
16
- CMD xvfb-run -s "-screen 0 1280x720x24" python finetune/gradio_app.py --server_name 0.0.0.0 --server_port 7860
 
 
 
1
  FROM pytorch/pytorch:2.2.2-cuda12.1-cudnn8-runtime
 
2
 
3
+ SHELL ["/bin/bash", "-c"]
4
 
5
+ # Environment variables for Hugging Face cache
6
+ ENV HF_HOME=/app/hf_cache
7
+ ENV TRANSFORMERS_CACHE=/app/hf_cache
8
+ ENV HF_TOKEN=${HF_TOKEN}
9
+ ENV PATH=/opt/conda/bin:$PATH
10
+ # Install system dependencies
11
+ RUN apt-get update && apt-get install -y \
12
+ git wget curl unzip ffmpeg libgl1-mesa-glx libglib2.0-0 && \
13
+ apt-get clean
14
 
15
+ # Set up working directory as /app
16
  WORKDIR /app
 
 
17
 
18
+ # Copy project into /app
19
+ COPY . /app
20
+
21
+ # Fix permissions for all subdirectories
22
+ RUN mkdir -p /app/pretrained /app/hf_cache /.cache/gdown && \
23
+ chmod -R 777 /app && \
24
+ chmod -R 777 /.cache && \
25
+ chmod -R 777 /root
26
+
27
+ # Create conda environment and install dependencies
28
+ COPY requirements.txt /app/requirements.txt
29
+ RUN conda create -n realcam python=3.10 -y && \
30
+ conda run -n realcam pip install --upgrade pip && \
31
+ conda run -n realcam pip install -r /app/requirements.txt
32
+
33
+ RUN chmod -R 777 /app /workspace
34
+
35
+ # # List contents (for debug)
36
+ RUN ls -la /app
37
+ RUN pip install gradio
38
+
39
+ # Expose Gradio default port
40
  EXPOSE 7860
41
+
42
+ # Start the Gradio app
43
+ CMD ["conda", "run", "--no-capture-output", "-n", "realcam", "python", "finetune/gradio_app.py"]