Skip to content

Commit

Permalink
restructure dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
cyntachs committed Jun 25, 2024
1 parent 7cea80f commit d583114
Showing 1 changed file with 15 additions and 20 deletions.
35 changes: 15 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,23 @@ LABEL version="py2.2-cuda12.1" maintainer="Cyntachs"

ARG DEBIAN_FRONTEND=noninteractive
ENV TZ="America/New_York"
RUN --mount=type=cache,target=/var/cache/apt,rw --mount=type=cache,target=/var/lib/apt,rw \
apt-get update && \
apt-get install git python3-pip -y && \
apt-get install -y tzdata && \
apt-get install libgl1 python3-opencv -y && \
apt-get clean
RUN --mount=type=cache,target=/root/.cache/pip \
pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu121 xformers opencv-python-headless

ENV ROOT=/stable-diffusion
RUN mkdir /docker
COPY . /docker/
RUN mkdir ${ROOT} && \
chmod +x /docker/entrypoint.sh && \
git config --global --add safe.directory /stable-diffusion
ENV NVIDIA_VISIBLE_DEVICES=all PYTHONPATH="${PYTHONPATH}:${PWD}" CLI_ARGS=""
COPY . /workspace/

RUN groupadd user && \
useradd user -g user -d /stable-diffusion && \
chown -R user:user /stable-diffusion
RUN --mount=type=cache,target=/var/cache/apt,rw --mount=type=cache,target=/var/lib/apt,rw set -eux; \
apt-get update; \
apt-get install git python3-pip -y; \
apt-get install -y tzdata; \
apt-get install libgl1 python3-opencv -y; \
apt-get clean; \
mkdir /stable-diffusion; \
chmod +x /workspace/entrypoint.sh; \
git config --global --add safe.directory /stable-diffusion; \
groupadd user; \
useradd user -g user -d /stable-diffusion; \
chown -R user:user /stable-diffusion;

ENV NVIDIA_VISIBLE_DEVICES=all
ENV PYTHONPATH="${PYTHONPATH}:${PWD}" CLI_ARGS=""
EXPOSE 5555
USER user:user
ENTRYPOINT [ "sh" , "/docker/entrypoint.sh" ]
ENTRYPOINT [ "sh" , "/workspace/entrypoint.sh" ]

0 comments on commit d583114

Please sign in to comment.