forked from xychelsea/deepfacelab-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.nvidia
96 lines (80 loc) · 2.95 KB
/
Dockerfile.nvidia
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
# DeepFaceLab Dockerfile for Anaconda with TensorFlow stack
# Copyright (C) 2020, 2021 Chelsea E. Manning
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
FROM xychelsea/ffmpeg-nvidia:v0.4.1
LABEL description="DeepFaceLab GPU Container"
# $ docker build --network=host -t xychelsea/deepfacelab:latest-gpu -f Dockerfile.nvidia .
# $ docker run --gpus all --rm -it xychelsea/deepfacelab:latest-gpu /bin/bash
# $ docker push xychelsea/deepfacelab:latest-gpu
ENV ANACONDA_ENV=deepfacelab
ENV DEEPFACELAB_PATH=/usr/local/deepfacelab
ENV DEEPFACELAB_PYTHON=python3.7
ENV DEEPFACELAB_HOME=${HOME}/deepfacelab
ENV DEEPFACELAB_WORKSPACE=${DEEPFACELAB_PATH}/workspace
ENV DEEPFACELAB_SCRIPTS=${DEEPFACELAB_PATH}/scripts
# Start as root
USER root
# Update packages
RUN apt-get update --fix-missing \
&& apt-get -y upgrade \
&& apt-get -y dist-upgrade
# Install dependencies
RUN apt-get -y install \
git \
libglu1-mesa-dev
# Create DeepFaceLab directory
RUN mkdir -p ${DEEPFACELAB_PATH} \
&& fix-permissions ${DEEPFACELAB_PATH}
# Switch to user "anaconda"
USER ${ANACONDA_UID}
WORKDIR ${HOME}
# Update Anaconda
RUN conda update -c defaults conda
# Create environment and install dependencies
RUN conda create -c nvidia -n deepfacelab python=3.7 cudnn=8.0.4 cudatoolkit=11.0.221 \
&& conda run -n deepfacelab pip3 install \
tqdm \
numpy==1.19.3 \
h5py==2.10.0 \
opencv-python==4.1.0.25 \
ffmpeg-python==0.1.17 \
scikit-image==0.14.2 \
scipy==1.4.1 \
colorama \
tensorflow-gpu==2.4.0 \
pyqt5 \
&& conda clean -afy
# Install rife from github repo
RUN git clone git://github.com/xychelsea/deepfacelab.git ${DEEPFACELAB_PATH} \
&& mkdir -p ${DEEPFACELAB_WORKSPACE} \
&& rm -rvf ${ANACONDA_PATH}/share/jupyter/lab/staging
# Switch back to root
USER root
RUN fix-permissions ${DEEPFACELAB_WORKSPACE} \
&& fix-permissions ${DEEPFACELAB_SCRIPTS} \
&& chmod +x ${DEEPFACELAB_SCRIPTS}/*.sh \
&& ln -s ${DEEPFACELAB_WORKSPACE} ${HOME}/workspace \
&& ln -s ${DEEPFACELAB_SCRIPTS} ${HOME}/scripts
# Clean Anaconda
RUN conda clean -afy
# Clean packages and caches
RUN apt-get --purge -y autoremove git \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/* \
&& rm -rvf /home/${ANACONDA_PATH}/.cache/yarn \
&& fix-permissions ${HOME} \
&& fix-permissions ${ANACONDA_PATH}
# Re-activate user "anaconda"
USER $ANACONDA_UID
WORKDIR $HOME