multimodalart HF staff commited on
Commit
7d05c8f
·
verified ·
1 Parent(s): 7c8246b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +23 -23
Dockerfile CHANGED
@@ -1,26 +1,21 @@
1
- FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04
2
 
 
3
  RUN useradd -m -u 1000 user
4
- USER user
5
 
6
  # Set environment variables
7
  ENV DEBIAN_FRONTEND=noninteractive
8
  ENV PYTHONUNBUFFERED=1
9
- ENV CONDA_DIR=/opt/conda
10
  ENV PATH=$CONDA_DIR/bin:$PATH
 
 
 
 
 
 
11
 
12
- # Install system dependencies
13
- RUN apt-get update && apt-get install -y --no-install-recommends \
14
- git \
15
- git-lfs \
16
- wget \
17
- curl \
18
- ca-certificates \
19
- build-essential \
20
- libsndfile1 \
21
- && rm -rf /var/lib/apt/lists/*
22
-
23
- # Install Miniconda
24
  RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \
25
  /bin/bash ~/miniconda.sh -b -p $CONDA_DIR && \
26
  rm ~/miniconda.sh && \
@@ -36,23 +31,28 @@ RUN conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c
36
  # Install flash-attention
37
  RUN pip install flash-attn --no-build-isolation
38
 
 
 
 
39
  # Clone YuE repository and install dependencies
40
- WORKDIR /app
41
  RUN git lfs install && \
42
  git clone https://github.com/multimodal-art-projection/YuE.git && \
43
  cd YuE && \
44
  pip install -r requirements.txt
45
 
46
  # Clone xcodec_mini_infer
47
- WORKDIR /app/YuE/inference
48
  RUN git clone https://huggingface.co/m-a-p/xcodec_mini_infer
49
 
50
  # Create output directory
51
- RUN mkdir -p /app/output
 
 
 
 
 
52
 
53
- # Copy entry script and wrapper
54
- COPY run.sh /app/
55
- COPY wrapper.py /app/YuE/inference/
56
- RUN chmod +x /app/run.sh
57
 
58
- ENTRYPOINT ["/app/run.sh"]
 
1
+ FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04 as builder
2
 
3
+ # Create non-root user first
4
  RUN useradd -m -u 1000 user
 
5
 
6
  # Set environment variables
7
  ENV DEBIAN_FRONTEND=noninteractive
8
  ENV PYTHONUNBUFFERED=1
9
+ ENV CONDA_DIR=/home/user/conda
10
  ENV PATH=$CONDA_DIR/bin:$PATH
11
+ ENV HOME=/home/user
12
+ ENV PATH=/home/user/.local/bin:$PATH
13
+
14
+ # Switch to user immediately
15
+ USER user
16
+ WORKDIR $HOME
17
 
18
+ # Install Miniconda in user's home directory
 
 
 
 
 
 
 
 
 
 
 
19
  RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \
20
  /bin/bash ~/miniconda.sh -b -p $CONDA_DIR && \
21
  rm ~/miniconda.sh && \
 
31
  # Install flash-attention
32
  RUN pip install flash-attn --no-build-isolation
33
 
34
+ # Set up app directory
35
+ WORKDIR $HOME/app
36
+
37
  # Clone YuE repository and install dependencies
 
38
  RUN git lfs install && \
39
  git clone https://github.com/multimodal-art-projection/YuE.git && \
40
  cd YuE && \
41
  pip install -r requirements.txt
42
 
43
  # Clone xcodec_mini_infer
44
+ WORKDIR $HOME/app/YuE/inference
45
  RUN git clone https://huggingface.co/m-a-p/xcodec_mini_infer
46
 
47
  # Create output directory
48
+ RUN mkdir -p $HOME/app/output
49
+
50
+ # Copy your files
51
+ COPY --chown=user:user run.sh $HOME/app/
52
+ COPY --chown=user:user wrapper.py $HOME/app/YuE/inference/
53
+ RUN chmod +x $HOME/app/run.sh
54
 
55
+ # Set final working directory to where run.sh is located
56
+ WORKDIR $HOME/app
 
 
57
 
58
+ ENTRYPOINT ["./run.sh"]