2023-02-20 16:40:05 -07:00
|
|
|
###################
|
|
|
|
# Builder Stage
|
2023-03-31 07:59:03 -06:00
|
|
|
FROM nvidia/cuda:11.8.0-devel-ubuntu22.04 AS builder
|
2023-02-20 16:40:05 -07:00
|
|
|
|
|
|
|
ARG DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
|
|
|
# Don't write .pyc bytecode
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1
|
|
|
|
|
|
|
|
# Create workspace working directory
|
|
|
|
RUN mkdir /build
|
|
|
|
WORKDIR /build
|
|
|
|
|
|
|
|
RUN rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
|
|
|
|
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
|
|
|
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
|
|
|
apt update && apt-get install -y \
|
|
|
|
git wget build-essential \
|
|
|
|
python3-venv python3-pip \
|
|
|
|
gnupg ca-certificates \
|
|
|
|
&& update-ca-certificates
|
|
|
|
|
|
|
|
ENV VIRTUAL_ENV=/workspace/venv
|
|
|
|
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
|
|
|
|
2023-03-29 09:20:18 -06:00
|
|
|
ADD requirements-build.txt /build
|
2023-02-20 16:40:05 -07:00
|
|
|
RUN --mount=type=cache,target=/root/.cache/pip \
|
|
|
|
python3 -m venv ${VIRTUAL_ENV} && \
|
2023-03-31 07:59:03 -06:00
|
|
|
pip install -U -I torch==2.0.0+cu118 torchvision==0.15.1+cu118 --extra-index-url "https://download.pytorch.org/whl/cu118" && \
|
2023-03-29 09:20:18 -06:00
|
|
|
pip install -r requirements-build.txt && \
|
2023-03-31 07:59:03 -06:00
|
|
|
pip install --no-deps xformers==0.0.18
|
2023-02-20 16:40:05 -07:00
|
|
|
|
|
|
|
###################
|
|
|
|
# Runtime Stage
|
2023-03-31 07:59:03 -06:00
|
|
|
FROM nvidia/cuda:11.8.0-runtime-ubuntu22.04 as runtime
|
2023-02-20 16:40:05 -07:00
|
|
|
|
|
|
|
# Use bash shell
|
|
|
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
|
|
|
ENV DEBIAN_FRONTEND noninteractive\
|
|
|
|
SHELL=/bin/bash
|
|
|
|
|
|
|
|
# Python logs go strait to stdout/stderr w/o buffering
|
|
|
|
ENV PYTHONUNBUFFERED=1
|
|
|
|
|
|
|
|
# Don't write .pyc bytecode
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1
|
|
|
|
|
|
|
|
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
|
|
|
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
|
|
|
apt update && apt install -y --no-install-recommends \
|
|
|
|
wget bash curl git git-lfs vim tmux \
|
|
|
|
build-essential lsb-release \
|
|
|
|
python3-pip python3-venv \
|
|
|
|
openssh-server \
|
|
|
|
gnupg ca-certificates && \
|
|
|
|
update-ca-certificates && \
|
|
|
|
apt-get clean && \
|
|
|
|
rm -rf /var/lib/apt/lists/* && \
|
|
|
|
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
|
|
|
|
|
|
|
|
# Install runpodctl
|
|
|
|
RUN wget https://github.com/runpod/runpodctl/releases/download/v1.9.0/runpodctl-linux-amd -O runpodctl && \
|
|
|
|
chmod a+x runpodctl && \
|
|
|
|
mv runpodctl /usr/local/bin
|
|
|
|
|
|
|
|
ENV VIRTUAL_ENV=/workspace/venv
|
|
|
|
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
|
|
|
COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}
|
2023-02-26 16:20:27 -07:00
|
|
|
RUN echo "source ${VIRTUAL_ENV}/bin/activate" >> /root/.bashrc
|
2023-02-20 16:40:05 -07:00
|
|
|
|
|
|
|
# Workaround for:
|
|
|
|
# https://github.com/TimDettmers/bitsandbytes/issues/62
|
|
|
|
# https://github.com/TimDettmers/bitsandbytes/issues/73
|
2023-03-31 07:59:03 -06:00
|
|
|
ENV LD_LIBRARY_PATH="/usr/local/cuda-11.8/targets/x86_64-linux/lib/"
|
|
|
|
RUN ln /usr/local/cuda/targets/x86_64-linux/lib/libcudart.so.11.8.89 /usr/local/cuda-11.8/targets/x86_64-linux/lib/libcudart.so
|
|
|
|
RUN ln /usr/local/cuda/targets/x86_64-linux/lib/libnvrtc.so.11.8.89 /usr/local/cuda-11.8/targets/x86_64-linux/lib/libnvrtc.so
|
2023-04-13 02:21:20 -06:00
|
|
|
|
2023-03-29 09:20:18 -06:00
|
|
|
ADD requirements-runtime.txt /
|
|
|
|
RUN pip install --no-cache-dir -r requirements-runtime.txt
|
2023-02-20 16:40:05 -07:00
|
|
|
|
|
|
|
WORKDIR /workspace
|
2023-02-26 16:20:27 -07:00
|
|
|
RUN git clone https://github.com/victorchall/EveryDream2trainer
|
2023-03-31 07:59:03 -06:00
|
|
|
|
2023-02-26 16:20:27 -07:00
|
|
|
WORKDIR /workspace/EveryDream2trainer
|
|
|
|
RUN python utils/get_yamls.py && \
|
|
|
|
mkdir -p logs && mkdir -p input
|
2023-02-20 16:40:05 -07:00
|
|
|
|
2023-02-26 16:20:27 -07:00
|
|
|
ADD welcome.txt /
|
|
|
|
ADD start.sh /
|
2023-02-20 16:40:05 -07:00
|
|
|
RUN chmod +x /start.sh
|
2023-03-31 07:59:03 -06:00
|
|
|
CMD [ "/start.sh" ]
|