radames commited on
Commit
327a922
1 Parent(s): 54602fe
Files changed (2) hide show
  1. Dockerfile +22 -23
  2. start.sh +21 -0
Dockerfile CHANGED
@@ -3,54 +3,53 @@ FROM nvidia/cuda:12.2.2-cudnn8-devel-ubuntu22.04
3
  ENV DEBIAN_FRONTEND=noninteractive \
4
  TZ=America/Los_Angeles
5
 
 
6
  ARG USE_PERSISTENT_DATA
7
 
8
  RUN apt-get update && apt-get install -y \
9
- git \
10
  make build-essential libssl-dev zlib1g-dev \
11
  libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
12
- libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev git-lfs \
13
  ffmpeg libsm6 libxext6 cmake libgl1-mesa-glx \
14
  && rm -rf /var/lib/apt/lists/* \
15
  && git lfs install
16
 
17
- WORKDIR /code
18
-
19
- COPY ./requirements.txt /code/requirements.txt
20
-
21
- # User
22
  RUN useradd -m -u 1000 user
23
  USER user
24
  ENV HOME=/home/user \
25
  PATH=/home/user/.local/bin:$PATH
26
 
27
- # Pyenv
28
  RUN curl https://pyenv.run | bash
29
  ENV PATH=$HOME/.pyenv/shims:$HOME/.pyenv/bin:$PATH
30
 
31
- ARG PYTHON_VERSION=3.10.13
32
- # Python
33
  RUN pyenv install $PYTHON_VERSION && \
34
  pyenv global $PYTHON_VERSION && \
35
  pyenv rehash && \
36
- pip install --no-cache-dir --upgrade pip setuptools wheel && \
37
- pip install --no-cache-dir \
38
- datasets \
39
- huggingface-hub "protobuf<4" "click<8.1"
40
 
41
- RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
 
 
 
 
 
 
42
 
43
- # Set the working directory to /data if USE_PERSISTENT_DATA is set, otherwise set to $HOME/app
44
  WORKDIR $HOME/app
45
- EXPOSE 9090
46
 
 
 
47
 
48
- COPY --chown=user:user ./invokeai.yaml /home/user/invokeai/invokeai.yaml
 
49
 
50
- # RUN ["invokeai-configure", "--yes", "--default_only", "--root", "."]
51
 
52
- # Install models according to https://github.com/invoke-ai/InvokeAI/blob/main/docs/installation/050_INSTALLING_MODELS.md
53
- # RUN ["invokeai-model-install", "--add","https://civitai.com/api/download/models/128713"]
54
 
55
- # Run IDE
56
- CMD ["invokeai-web"]
 
3
  ENV DEBIAN_FRONTEND=noninteractive \
4
  TZ=America/Los_Angeles
5
 
6
+ ARG PYTHON_VERSION=3.10.13
7
  ARG USE_PERSISTENT_DATA
8
 
9
  RUN apt-get update && apt-get install -y \
10
+ git git-lfs \
11
  make build-essential libssl-dev zlib1g-dev \
12
  libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
13
+ libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev \
14
  ffmpeg libsm6 libxext6 cmake libgl1-mesa-glx \
15
  && rm -rf /var/lib/apt/lists/* \
16
  && git lfs install
17
 
 
 
 
 
 
18
  RUN useradd -m -u 1000 user
19
  USER user
20
  ENV HOME=/home/user \
21
  PATH=/home/user/.local/bin:$PATH
22
 
 
23
  RUN curl https://pyenv.run | bash
24
  ENV PATH=$HOME/.pyenv/shims:$HOME/.pyenv/bin:$PATH
25
 
 
 
26
  RUN pyenv install $PYTHON_VERSION && \
27
  pyenv global $PYTHON_VERSION && \
28
  pyenv rehash && \
29
+ python -m venv $HOME/.venv
30
+
31
+ ENV PATH="$HOME/.venv/bin:$PATH"
32
+ RUN echo 'source $HOME/.venv/bin/activate' >> $HOME/.bashrc
33
 
34
+ RUN pip install --no-cache-dir --upgrade pip setuptools wheel
35
+
36
+ WORKDIR /tmp
37
+ COPY --chown=user:user ./requirements.txt /tmp/requirements.txt
38
+ RUN pip install --no-cache-dir --upgrade -r /tmp/requirements.txt
39
+
40
+ RUN pip install InvokeAI --use-pep517 --extra-index-url https://download.pytorch.org/whl/cu121
41
 
 
42
  WORKDIR $HOME/app
 
43
 
44
+ ENV INVOKEAI_ROOT=${USE_PERSISTENT_DATA:+/data/invokeai}
45
+ ENV INVOKEAI_ROOT=${INVOKEAI_ROOT:-$HOME/invokeai}
46
 
47
+ COPY --chown=user:user ./start.sh $HOME/start.sh
48
+ COPY --chown=user:user invokeai.yaml $HOME/invokeai.yaml
49
 
50
+ RUN chmod +x $HOME/start.sh
51
 
52
+ EXPOSE 9090
 
53
 
54
+ ENTRYPOINT ["/bin/bash", "-c"]
55
+ CMD ["/home/user/start.sh"]
start.sh ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ # Activate virtual environment
5
+ source $HOME/.venv/bin/activate
6
+
7
+ echo "Current PATH: $PATH"
8
+ echo "INVOKEAI_ROOT: $INVOKEAI_ROOT"
9
+ echo "Python version: $(python --version)"
10
+ echo "Pip version: $(pip --version)"
11
+
12
+ # Create INVOKEAI_ROOT directory if it doesn't exist
13
+ mkdir -p $INVOKEAI_ROOT
14
+
15
+ # Copy invokeai.yaml to INVOKEAI_ROOT if it doesn't exist
16
+ if [ ! -f "$INVOKEAI_ROOT/invokeai.yaml" ]; then
17
+ cp $HOME/invokeai.yaml $INVOKEAI_ROOT/invokeai.yaml
18
+ fi
19
+
20
+ # Run invokeai-web
21
+ exec invokeai-web