feat(docker): update docker image, etc. to python3.11+ubuntu23.04

This commit is contained in:
Eugene Brodsky 2023-10-10 23:03:25 -04:00
parent 9195c8c957
commit f102e38076
3 changed files with 8 additions and 23 deletions

12
.gitignore vendored
View File

@ -1,8 +1,5 @@
.idea/ .idea/
# ignore the Anaconda/Miniconda installer used while building Docker image
anaconda.sh
# Byte-compiled / optimized / DLL files # Byte-compiled / optimized / DLL files
__pycache__/ __pycache__/
*.py[cod] *.py[cod]
@ -136,12 +133,10 @@ celerybeat.pid
# Environments # Environments
.env .env
.venv .venv*
env/ env/
venv/ venv/
ENV/ ENV/
env.bak/
venv.bak/
# Spyder project settings # Spyder project settings
.spyderproject .spyderproject
@ -186,11 +181,6 @@ cython_debug/
.scratch/ .scratch/
.vscode/ .vscode/
# ignore environment.yml and requirements.txt
# these are links to the real files in environments-and-requirements
environment.yml
requirements.txt
# source installer files # source installer files
installer/*zip installer/*zip
installer/install.bat installer/install.bat

View File

@ -2,7 +2,7 @@
## Builder stage ## Builder stage
FROM library/ubuntu:22.04 AS builder FROM library/ubuntu:23.04 AS builder
ARG DEBIAN_FRONTEND=noninteractive ARG DEBIAN_FRONTEND=noninteractive
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 rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
@ -10,7 +10,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \ --mount=type=cache,target=/var/lib/apt,sharing=locked \
apt update && apt-get install -y \ apt update && apt-get install -y \
git \ git \
python3.10-venv \ python3-venv \
python3-pip \ python3-pip \
build-essential build-essential
@ -37,7 +37,7 @@ RUN --mount=type=cache,target=/root/.cache/pip \
elif [ "$GPU_DRIVER" = "rocm" ]; then \ elif [ "$GPU_DRIVER" = "rocm" ]; then \
extra_index_url_arg="--extra-index-url https://download.pytorch.org/whl/rocm5.4.2"; \ extra_index_url_arg="--extra-index-url https://download.pytorch.org/whl/rocm5.4.2"; \
else \ else \
extra_index_url_arg="--extra-index-url https://download.pytorch.org/whl/cu118"; \ extra_index_url_arg="--extra-index-url https://download.pytorch.org/whl/cu121"; \
fi &&\ fi &&\
pip install $extra_index_url_arg \ pip install $extra_index_url_arg \
torch==$TORCH_VERSION \ torch==$TORCH_VERSION \
@ -70,7 +70,7 @@ RUN --mount=type=cache,target=/usr/lib/node_modules \
#### Runtime stage --------------------------------------- #### Runtime stage ---------------------------------------
FROM library/ubuntu:22.04 AS runtime FROM library/ubuntu:23.04 AS runtime
ARG DEBIAN_FRONTEND=noninteractive ARG DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1 ENV PYTHONUNBUFFERED=1
@ -85,6 +85,7 @@ RUN apt update && apt install -y --no-install-recommends \
iotop \ iotop \
bzip2 \ bzip2 \
gosu \ gosu \
magic-wormhole \
libglib2.0-0 \ libglib2.0-0 \
libgl1-mesa-glx \ libgl1-mesa-glx \
python3-venv \ python3-venv \
@ -94,10 +95,6 @@ RUN apt update && apt install -y --no-install-recommends \
libstdc++-10-dev &&\ libstdc++-10-dev &&\
apt-get clean && apt-get autoclean apt-get clean && apt-get autoclean
# globally add magic-wormhole
# for ease of transferring data to and from the container
# when running in sandboxed cloud environments; e.g. Runpod etc.
RUN pip install magic-wormhole
ENV INVOKEAI_SRC=/opt/invokeai ENV INVOKEAI_SRC=/opt/invokeai
ENV VIRTUAL_ENV=/opt/venv/invokeai ENV VIRTUAL_ENV=/opt/venv/invokeai
@ -120,9 +117,7 @@ WORKDIR ${INVOKEAI_SRC}
RUN cd /usr/lib/$(uname -p)-linux-gnu/pkgconfig/ && ln -sf opencv4.pc opencv.pc RUN cd /usr/lib/$(uname -p)-linux-gnu/pkgconfig/ && ln -sf opencv4.pc opencv.pc
RUN python3 -c "from patchmatch import patch_match" RUN python3 -c "from patchmatch import patch_match"
# Create unprivileged user and make the local dir RUN mkdir -p ${INVOKEAI_ROOT} && chown -R 1000:1000 ${INVOKEAI_ROOT}
RUN useradd --create-home --shell /bin/bash -u 1000 --comment "container local user" invoke
RUN mkdir -p ${INVOKEAI_ROOT} && chown -R invoke:invoke ${INVOKEAI_ROOT}
COPY docker/docker-entrypoint.sh ./ COPY docker/docker-entrypoint.sh ./
ENTRYPOINT ["/opt/invokeai/docker-entrypoint.sh"] ENTRYPOINT ["/opt/invokeai/docker-entrypoint.sh"]

View File

@ -19,7 +19,7 @@ set -e -o pipefail
# Default UID: 1000 chosen due to popularity on Linux systems. Possibly 501 on MacOS. # Default UID: 1000 chosen due to popularity on Linux systems. Possibly 501 on MacOS.
USER_ID=${CONTAINER_UID:-1000} USER_ID=${CONTAINER_UID:-1000}
USER=invoke USER=ubuntu
usermod -u ${USER_ID} ${USER} 1>/dev/null usermod -u ${USER_ID} ${USER} 1>/dev/null
configure() { configure() {