forked from xychelsea/deepfacelab-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.nvidia-jupyter
113 lines (92 loc) · 3.41 KB
/
Dockerfile.nvidia-jupyter
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
# 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-jupyter
LABEL description="DeepFaceLab GPU Container w/ Jupyter Notebooks"
# $ docker build --network=host -t xychelsea/deepfacelab:latest-gpu-jupyter -f Dockerfile.nvidia-jupyter .
# $ docker run --rm -it -d -p 8888:8888 xychelsea/deepfacelab:latest-gpu-jupyter
# $ docker push xychelsea/deepfacelab:latest-gpu-jupyter
ENV ANACONDA_ENV=deepfacelab
ENV DEEPFACELAB_PATH=/usr/local/notebooks/deepfacelab
ENV DEEPFACELAB_PYTHON=python3.7
ENV DEEPFACELAB_HOME=${HOME}/notebooks/deepfacelab
ENV DEEPFACELAB_WORKSPACE=${DEEPFACELAB_PATH}/workspace
ENV DEEPFACELAB_SCRIPTS=${DEEPFACELAB_PATH}/scripts
# Start as root
USER root
# nvidia key
RUN rm /etc/apt/sources.list.d/cuda.list
RUN rm /etc/apt/sources.list.d/nvidia-ml.list
# 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 -n deepfacelab -c nvidia \
python \
cudnn \
cudatoolkit \
&& conda clean -afy
#RUN 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
# Install Jupyter Notebook
RUN conda install -n ${ANACONDA_ENV} -c conda-forge \
ipykernel \
&& conda run -n ${ANACONDA_ENV} ipython kernel install --user --name=${ANACONDA_ENV} \
&& conda clean -afy \
&& rm -rvf ${ANACONDA_PATH}/share/jupyter/lab/staging
# Install deepfacelab 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