roll-ai commited on
Commit
cb33a1e
·
verified ·
1 Parent(s): fa80bfc

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +26 -25
Dockerfile CHANGED
@@ -1,33 +1,34 @@
1
- FROM pytorch/pytorch:2.2.2-cuda12.1-cudnn8-runtime
2
 
3
- SHELL ["/bin/bash", "-c"]
4
- ENV PATH=/opt/conda/bin:$PATH \
5
- HF_HOME=/app/hf_cache \
6
- TRANSFORMERS_CACHE=/app/hf_cache \
7
- PIP_NO_CACHE_DIR=1 \
8
- PYTHONDONTWRITEBYTECODE=1 \
9
- PYTHONUNBUFFERED=1
10
 
11
- WORKDIR /app
 
 
 
12
 
13
- # OS deps (one layer) + clean
14
- RUN apt-get update && apt-get install -y --no-install-recommends \
15
- git wget curl unzip ffmpeg libgl1 libglib2.0-0 \
16
- && rm -rf /var/lib/apt/lists/*
 
17
 
18
- # Leverage build cache: install Python deps first
19
- COPY requirements.txt /app/requirements.txt
20
- RUN pip install --upgrade pip && pip install -r /app/requirements.txt
21
 
22
- # Then copy the rest of the project
23
- COPY . /app
24
 
25
- # Optional: run as non-root (better security)
26
- # RUN useradd -m app && chown -R app:app /app
27
- # USER app
28
 
29
- # Gradio on 0.0.0.0 in containers
30
- ENV GRADIO_SERVER_NAME=0.0.0.0
31
- EXPOSE 7860
32
 
33
- CMD ["python", "finetune/gradio_app.py"]
 
 
 
1
+ FROM nvidia/cuda:12.1.105-cudnn8-devel-ubuntu22.04
2
 
3
+ ENV DEBIAN_FRONTEND=noninteractive \
4
+ PATH=/opt/conda/bin:$PATH \
5
+ CUDA_HOME=/usr/local/cuda
 
 
 
 
6
 
7
+ # Install system dependencies
8
+ RUN apt-get update && apt-get install -y \
9
+ wget git libgl1-mesa-glx libgl1-mesa-dri xvfb ffmpeg build-essential \
10
+ && rm -rf /var/lib/apt/lists/*
11
 
12
+ # Install Miniconda
13
+ RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && \
14
+ bash /tmp/miniconda.sh -b -p /opt/conda && \
15
+ rm /tmp/miniconda.sh && \
16
+ /opt/conda/bin/conda clean -afy
17
 
18
+ # Create conda env
19
+ RUN conda create -n appenv python=3.10 -y && conda clean -afy
20
+ SHELL ["conda", "run", "-n", "appenv", "/bin/bash", "-c"]
21
 
22
+ # Install ffmpeg from conda-forge
23
+ RUN conda install ffmpeg=7 -c conda-forge -y && conda clean -afy
24
 
25
+ # Copy project
26
+ WORKDIR /workspace
27
+ COPY requirements.txt .
28
 
29
+ # Install Python dependencies (flash-attn will now compile)
30
+ RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt
 
31
 
32
+ COPY . .
33
+
34
+ CMD ["conda", "run", "--no-capture-output", "-n", "appenv", "python", "app.py"]