sachin commited on
Commit
badf26d
·
1 Parent(s): b734e0b
Files changed (2) hide show
  1. .dockerignore +81 -0
  2. Dockerfile.base +17 -18
.dockerignore ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ samples
2
+ *.wav
3
+ *.log
4
+ venv
5
+ *.nemo
6
+
7
+ # Ignore all Python files except those explicitly copied
8
+ *.pyc
9
+ *.pyo
10
+ *.pyd
11
+
12
+ # Ignore all virtual environments
13
+ venv/
14
+ env/
15
+ .env/
16
+ .venv/
17
+ __pycache__/
18
+
19
+ # Ignore build artifacts
20
+ build/
21
+ dist/
22
+ *.egg-info/
23
+
24
+ # Ignore local version control files
25
+ .git/
26
+ .gitignore
27
+
28
+ # Ignore local environment files
29
+ .env
30
+
31
+ # Ignore local log files
32
+ *.log
33
+
34
+ # Ignore all node_modules
35
+ node_modules/
36
+
37
+ # Ignore all Docker-related files
38
+ Dockerfile
39
+ docker-compose.yml
40
+
41
+ # Ignore all local development files
42
+ .vscode/
43
+ .idea/
44
+ .pytest_cache/
45
+
46
+ # Ignore all test files
47
+ *.test.*
48
+ *.spec.*
49
+ *_test.*
50
+ *_spec.*
51
+
52
+ # Ignore all backup files
53
+ *.bak
54
+ *.swp
55
+ *.tmp
56
+ *.orig
57
+
58
+ # Ignore all documentation files
59
+ *.md
60
+ *.txt
61
+ *.rst
62
+
63
+ # Ignore all temporary files
64
+ *.tmp
65
+ *.temp
66
+ *.cache
67
+
68
+ # Ignore all user-specific files
69
+ *.user
70
+ *.prefs
71
+ *.rc
72
+
73
+ # Ignore all unnecessary directories and files
74
+ __pycache__
75
+ __pypackages__
76
+
77
+
78
+ !requirements.txt
79
+
80
+ #!model_requirements.txt
81
+ #!server_requirements.txt
Dockerfile.base CHANGED
@@ -1,35 +1,34 @@
1
  # Base image with CUDA support
2
  FROM nvidia/cuda:12.8.0-cudnn-devel-ubuntu22.04 AS model-downloader
 
3
  WORKDIR /app
4
 
5
- # Install system dependencies
6
- RUN apt-get update && apt-get install -y \
7
  python3 \
8
- python3-pip python3-distutils python3-dev python3-venv \
 
9
  git \
10
  ffmpeg \
11
- sudo wget curl software-properties-common build-essential gcc g++ \
 
12
  && ln -s /usr/bin/python3 /usr/bin/python \
13
- && rm -rf /var/lib/apt/lists/*
14
 
15
- # Install Rust
16
- RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
17
- ENV PATH="/root/.cargo/bin:${PATH}"
18
 
19
- # Set compiler environment variables
20
  ENV CC=/usr/bin/gcc
21
  ENV CXX=/usr/bin/g++
22
 
23
- # Upgrade pip and install base Python dependencies
24
- RUN pip install --upgrade pip setuptools setuptools-rust torch
25
- RUN pip install flash-attn --no-build-isolation
26
-
27
- # Copy requirements and configuration files
28
  COPY requirements.txt .
 
 
 
29
 
30
- # Install Python dependencies
31
- RUN pip install --no-cache-dir -r requirements.txt
32
  # Set up user
33
- RUN useradd -ms /bin/bash appuser \
34
- && chown -R appuser:appuser /app
35
  USER appuser
 
1
  # Base image with CUDA support
2
  FROM nvidia/cuda:12.8.0-cudnn-devel-ubuntu22.04 AS model-downloader
3
+
4
  WORKDIR /app
5
 
6
+ # Install only essential system dependencies in a single RUN to reduce layers
7
+ RUN apt-get update && apt-get install -y --no-install-recommends \
8
  python3 \
9
+ python3-pip \
10
+ python3-dev \
11
  git \
12
  ffmpeg \
13
+ curl \
14
+ build-essential \
15
  && ln -s /usr/bin/python3 /usr/bin/python \
16
+ && apt-get clean && rm -rf /var/lib/apt/lists/*
17
 
18
+ # Install Rust in a single command and clean up
19
+ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path --profile minimal \
20
+ && rm -rf /root/.rustup/toolchains/*/share/doc
21
 
22
+ ENV PATH="/root/.cargo/bin:${PATH}"
23
  ENV CC=/usr/bin/gcc
24
  ENV CXX=/usr/bin/g++
25
 
26
+ # Upgrade pip and install Python dependencies in one layer
 
 
 
 
27
  COPY requirements.txt .
28
+ RUN pip install --no-cache-dir --upgrade pip setuptools setuptools-rust torch && \
29
+ pip install --no-cache-dir flash-attn --no-build-isolation && \
30
+ pip install --no-cache-dir -r requirements.txt
31
 
 
 
32
  # Set up user
33
+ RUN useradd -ms /bin/bash appuser && chown -R appuser:appuser /app
 
34
  USER appuser