-
-
Notifications
You must be signed in to change notification settings - Fork 20
/
Dockerfile
159 lines (147 loc) · 5.09 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
FROM ubuntu:22.04 as base_image
USER root
ENV TZ=America/Denver
ENV HOME=/app
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \
&& apt-get update \
&& apt-get upgrade -y \
&& apt install software-properties-common -y \
&& add-apt-repository ppa:ubuntu-toolchain-r/test \
&& apt-get update \
&& apt install libtinfo6 -y \
&& apt-get install -y git \
&& apt-get install -y wget \
&& apt-get install -y software-properties-common \
&& apt-get install -y gcc-9 \
&& apt-get install -y g++-9 \
&& apt-get install -y bash \
&& apt-get install -y build-essential \
&& apt-get install -y libssl-dev \
&& apt-get install -y libffi-dev \
&& apt-get install -y libgl1-mesa-dev \
&& apt-get install -y fonts-noto-color-emoji \
&& apt-get install -y libportaudio2 \
&& apt-get install -y libxcb-cursor0 \
&& apt-get install -y espeak \
&& apt-get install -y xclip \
&& apt-get install -y libjpeg-dev \
&& apt-get install -y zlib1g-dev \
&& apt-get install -y libpng-dev \
&& apt-get install -y patchelf \
&& apt-get install -y ccache \
&& apt-get install -y libxcb-xinerama0 \
&& apt-get install -y gstreamer1.0-gl \
&& apt-get install -y cmake \
&& apt-get install -y ninja-build \
&& apt-get install -y python3 \
&& apt-get install -y python3-pip \
&& apt-get install -y python3.10 \
&& apt-get install -y python3.10-distutils \
&& apt-get install -y python3.10-tk \
&& apt-get install -y upx \
&& apt-get install -y libgl1-mesa-glx \
&& apt-get install -y libglib2.0-0 \
&& apt-get install -y libsm6 \
&& apt-get install -y libxext6 \
&& apt-get install -y libxrender-dev \
&& ln -s /usr/share/tcltk/tcl8.6 /usr/share/tcltk/tcl8 \
&& rm -rf /var/lib/apt/lists/ \
&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-9 \
&& rm -rf /var/lib/apt/lists/*
FROM base_image as download_qt
USER root
ENV TZ=America/Denver
ENV HOME=/app
RUN wget https://download.qt.io/archive/qt/6.7/6.7.0/single/qt-everywhere-src-6.7.0.tar.xz
FROM download_qt as build_qt
USER root
ENV TZ=America/Denver
ENV HOME=/app
RUN tar -xf qt-everywhere-src-6.7.0.tar.xz \
&& cd qt-everywhere-src-6.7.0 \
&& cmake -G Ninja -B build -DCMAKE_INSTALL_PREFIX=/usr/local/qt6 \
&& cmake --build build --parallel
FROM build_qt as install_qt
USER root
ENV TZ=America/Denver
ENV HOME=/app
RUN cd qt-everywhere-src-6.7.0/build \
&& if [ -f cmake_install.cmake ]; then cmake --install .; else echo "cmake_install.cmake not found"; exit 1; fi \
&& cd ../.. \
&& rm -rf qt-everywhere-src-6.7.0 qt-everywhere-src-6.7.0.tar.xz
FROM install_qt as create_user
ENV DEBIAN_FRONTEND=noninteractive
RUN useradd -ms /bin/bash appuser \
&& chown -R appuser:appuser /app \
&& apt-get update \
&& apt-get install -y libxkbcommon-x11-0 \
&& apt-get install -y nvidia-cudnn \
&& rm -rf /var/lib/apt/lists/*
USER appuser
WORKDIR /app
ENV HOME=/app
ENV PATH="/home/appuser/.local/bin:${PATH}"
ENV PYTHONUSERBASE=/home/appuser/.local
ENV PATH="/usr/local/qt6/bin:${PATH}"
ENV LD_LIBRARY_PATH="/usr/local/qt6/lib:${LD_LIBRARY_PATH}"
FROM create_user as install_requirements
USER appuser
WORKDIR /app
ENV HOME=/app
ENV PATH="/home/appuser/.local/bin:${PATH}"
ENV PYTHONUSERBASE=/home/appuser/.local
RUN pip install nvidia-pyindex
WORKDIR /app
RUN pip install --upgrade pip
RUN pip install --upgrade setuptools
RUN pip install --upgrade wheel
RUN pip install requests accelerate cmake
RUN pip uninstall torch torchvision -y
RUN pip install torch torchvision --index-url https://download.pytorch.org/whl/cu118 --upgrade
FROM install_requirements as install_apps
USER appuser
WORKDIR /app
ENV HOME=/app
ENV PATH="/home/appuser/.local/bin:${PATH}"
ENV PYTHONUSERBASE=/home/appuser/.local
RUN python3 -c "from accelerate.utils import write_basic_config; write_basic_config(mixed_precision='fp16')"
FROM install_apps as more_env
USER appuser
WORKDIR /app
ENV HOME=/app
ENV PATH="/home/appuser/.local/bin:${PATH}"
ENV PYTHONUSERBASE=/home/appuser/.local
RUN pip install pyinstaller
FROM more_env as build_files
USER appuser
WORKDIR /app
ENV HOME=/app
ENV PATH="/home/appuser/.local/bin:${PATH}"
ENV PYTHONUSERBASE=/home/appuser/.local
COPY dobuild.py dobuild.py
COPY build.sh build.sh
COPY setup.py setup.py
FROM build_files as build_airunner
USER appuser
WORKDIR /app
ENV HOME=/app
ENV PATH="/home/appuser/.local/bin:${PATH}"
ENV PYTHONUSERBASE=/home/appuser/.local
RUN git clone https://github.com/Capsize-Games/airunner.git /app/airunner \
&& cd /app/airunner \
&& git checkout master \
&& git pull \
&& python3 -m pip install build \
&& python3 -m build \
&& cd /app/airunner/dist \
&& WHL_FILE=$(ls airunner-*.whl) \
&& python3 -m pip install build $WHL_FILE
FROM build_airunner as build_airunner_executable
USER appuser
WORKDIR /app
ENV HOME=/app
ENV PATH="/home/appuser/.local/bin:${PATH}"
ENV PYTHONUSERBASE=/home/appuser/.local
ENV DOCKER_ENV=true
COPY airunner.spec airunner.spec
COPY ./lib/tokenizers/punkt /app/lib/tokenizers/punkt