InvokeAI/docker-build/Dockerfile
Matthias Wild 1a1625406c
Make Dockerfile cloud ready (tested on runpod) (#1950)
* Push dockerfile (#18)

* update build-container.yml

* add login step to build-container.yml

* update job name

* update matrix: add registry and platforms
also set latest only for cuda image

* quote string

* use latest for amd and cuda image

* separate images for cuda and amd

* change latest from auto to true

* configure_invoke -y instead of --interactive

* fix argument to --yes

* update matrix:
- use flavor instead of pip-requirements
- add flavor `cloud`
- add `dockerfile`

* introduce INVOKE_MODEL_RECONFIGURE

* add `--cap-add=sys_nice` to run.sh

* update Dockerfile: install wheel

* only have main branch in action again

* disable push of cloud image for now
since it still has it's own workflow, but PoC succeeded

* remove now untrue comments in top

* install pip, setuptools and wheel in sep. step

* add labels to the image

* remove doubled installation of wheel
2022-12-12 17:54:42 -05:00

56 lines
1.3 KiB
Docker

FROM python:3.10-slim AS builder
# use bash
SHELL [ "/bin/bash", "-c" ]
# Install necesarry packages
RUN apt-get update \
&& apt-get install -y \
--no-install-recommends \
gcc=4:10.2.* \
libgl1-mesa-glx=20.3.* \
libglib2.0-0=2.66.* \
python3-dev=3.9.* \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# set workdir, PATH and copy sources
WORKDIR /usr/src/app
ENV PATH /usr/src/app/.venv/bin:$PATH
ARG PIP_REQUIREMENTS=requirements-lin-cuda.txt
COPY . ./environments-and-requirements/${PIP_REQUIREMENTS} ./
# install requirements
RUN python3 -m venv .venv \
&& pip install \
--upgrade \
--no-cache-dir \
'pip>=22.3.1' \
'setuptools>=65.5.0' \
'wheel>=0.38.4' \
&& pip install \
--no-cache-dir \
-r ${PIP_REQUIREMENTS}
FROM python:3.10-slim AS runtime
# Install necesarry packages
RUN apt-get update \
&& apt-get install -y \
--no-install-recommends \
libgl1-mesa-glx=20.3.* \
libglib2.0-0=2.66.* \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /usr/src/app
COPY --from=builder /usr/src/app .
# set Environment, Entrypoint and default CMD
ENV INVOKEAI_ROOT /data
ENV INVOKE_MODEL_RECONFIGURE --yes
ENV PATH=/usr/src/app/.venv/bin:$PATH
ENTRYPOINT [ "python3", "scripts/invoke.py" ]
CMD [ "--web", "--host=0.0.0.0" ]