Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
c10a6fd
fix(docker) rocm 2.4.6 based image
heathen711 Jun 29, 2025
96523ca
fix(docker) Add cloned dockerbuild
heathen711 Jun 29, 2025
28e0242
Fix tagging & remove force reinstall
heathen711 Jul 3, 2025
47508b8
bugfix(docker) combined the dockerfiles and reduced image size
heathen711 Jul 3, 2025
f27471c
bugfix(docker): Use uv.lock for docker, and update to newer index urls.
heathen711 Jul 3, 2025
641a6cf
bugfix(docker) Remove the need for UV index as that is now baked into…
heathen711 Jul 3, 2025
a3cb3e0
bugfix(ci) Clean up more space for typegen check
heathen711 Jul 3, 2025
0db304f
bugfix(uv) Lock torchvision and ensure the docker uses the same rocm …
heathen711 Jul 5, 2025
31ca314
Missed files
heathen711 Jul 5, 2025
6d7b231
Merge remote-tracking branch 'origin' into bugfix/heathen711/rocm-docker
heathen711 Jul 5, 2025
8c5fcfd
cleanup(docker) remove no cache argument
heathen711 Jul 5, 2025
233740a
Merge remote-tracking branch 'origin' into bugfix/heathen711/rocm-docker
heathen711 Jul 9, 2025
8213f62
bugfix(docker) render group controls the devices, but it needs to mat…
heathen711 Jul 9, 2025
3e8e0f6
Merge remote-tracking branch 'origin' into bugfix/heathen711/rocm-docker
heathen711 Jul 10, 2025
78eb6b0
cleanup(docker)
heathen711 Jul 10, 2025
017d38e
cleanup(github actions)
heathen711 Jul 10, 2025
1b6ebed
Revert "cleanup(github actions)"
heathen711 Jul 10, 2025
2caa1b1
Merge remote-tracking branch 'origin' into bugfix/heathen711/rocm-docker
heathen711 Jul 13, 2025
4b5c481
Merge remote-tracking branch 'origin' into bugfix/heathen711/rocm-docker
heathen711 Jul 17, 2025
c84f846
bugfix(pyproject) Convert from dependency groups to extras and update…
heathen711 Jul 17, 2025
687cccd
cleanup(docker)
heathen711 Jul 17, 2025
89ceecc
bugfix(docker) Ensure the correct extra install.
heathen711 Jul 17, 2025
1cdd4b5
bugfix(docs) link syntax
heathen711 Jul 17, 2025
ae4e38c
Merge branch 'main' into bugfix/heathen711/rocm-docker
heathen711 Jul 29, 2025
1424b7c
Merge branch 'main' into bugfix/heathen711/rocm-docker
ebr Jul 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 39 additions & 14 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ RUN --mount=type=cache,target=/var/cache/apt \
libglx-mesa0 \
build-essential \
libopencv-dev \
libstdc++-10-dev
libstdc++-10-dev \
wget

ENV \
PYTHONUNBUFFERED=1 \
Expand All @@ -44,7 +45,6 @@ ENV \
UV_MANAGED_PYTHON=1 \
UV_LINK_MODE=copy \
UV_PROJECT_ENVIRONMENT=/opt/venv \
UV_INDEX="https://download.pytorch.org/whl/cu124" \
INVOKEAI_ROOT=/invokeai \
INVOKEAI_HOST=0.0.0.0 \
INVOKEAI_PORT=9090 \
Expand All @@ -54,6 +54,10 @@ ENV \

ARG GPU_DRIVER=cuda

ARG CUDA_TORCH="https://download.pytorch.org/whl/cu124"
ARG CPU_TORCH="https://download.pytorch.org/whl/cpu"
ARG ROCM_TORCH="https://download.pytorch.org/whl/rocm6.2.4"

# Install `uv` for package management
COPY --from=ghcr.io/astral-sh/uv:0.6.9 /uv /uvx /bin/

Expand All @@ -72,23 +76,41 @@ WORKDIR ${INVOKEAI_SRC}
# x86_64/CUDA is the default
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
--mount=type=bind,source=uv.lock,target=uv.lock \
# Cannot use uv sync and uv.lock as that is locked to CUDA version packages, which breaks rocm...
# --mount=type=bind,source=uv.lock,target=uv.lock \
# this is just to get the package manager to recognize that the project exists, without making changes to the docker layer
--mount=type=bind,source=invokeai/version,target=invokeai/version \
if [ "$TARGETPLATFORM" = "linux/arm64" ] || [ "$GPU_DRIVER" = "cpu" ]; then UV_INDEX="https://download.pytorch.org/whl/cpu"; \
elif [ "$GPU_DRIVER" = "rocm" ]; then UV_INDEX="https://download.pytorch.org/whl/rocm6.2"; \
ulimit -n 30000 && \
if [ "$TARGETPLATFORM" = "linux/arm64" ] || [ "$GPU_DRIVER" = "cpu" ]; then export UV_INDEX="$CPU_TORCH"; \
elif [ "$GPU_DRIVER" = "rocm" ]; then export UV_INDEX="$ROCM_TORCH"; \
else export UV_INDEX="$CUDA_TORCH"; \
fi && \
uv sync --frozen
uv venv --python 3.12 && \
# Use the public version to install existing known dependencies but using the UV_INDEX, not the hardcoded URLs within the uv.lock
uv pip install invokeai

RUN --mount=type=cache,target=/var/cache/apt \
--mount=type=cache,target=/var/lib/apt \
if [ "$GPU_DRIVER" = "rocm" ]; then \
wget -O /tmp/amdgpu-install.deb \
https://repo.radeon.com/amdgpu-install/6.2.4/ubuntu/noble/amdgpu-install_6.2.60204-1_all.deb && \
apt install -y /tmp/amdgpu-install.deb && \
apt update && \
amdgpu-install --usecase=rocm -y && \
apt-get autoclean && \
apt clean && \
rm -rf /tmp/* /var/tmp/* && \
usermod -a -G render ubuntu && \
usermod -a -G video ubuntu && \
echo "\\n/opt/rocm/lib\\n/opt/rocm/lib64" >> /etc/ld.so.conf.d/rocm.conf && \
ldconfig && \
update-alternatives --auto rocm; \
fi

# build patchmatch
RUN cd /usr/lib/$(uname -p)-linux-gnu/pkgconfig/ && ln -sf opencv4.pc opencv.pc
RUN python -c "from patchmatch import patch_match"

# Link amdgpu.ids for ROCm builds
# contributed by https://github.com/Rubonnek
RUN mkdir -p "/opt/amdgpu/share/libdrm" &&\
ln -s "/usr/share/libdrm/amdgpu.ids" "/opt/amdgpu/share/libdrm/amdgpu.ids"

RUN mkdir -p ${INVOKEAI_ROOT} && chown -R ${CONTAINER_UID}:${CONTAINER_GID} ${INVOKEAI_ROOT}

COPY docker/docker-entrypoint.sh ./
Expand All @@ -105,9 +127,12 @@ COPY invokeai ${INVOKEAI_SRC}/invokeai
# in a previous layer
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
--mount=type=bind,source=uv.lock,target=uv.lock \
if [ "$TARGETPLATFORM" = "linux/arm64" ] || [ "$GPU_DRIVER" = "cpu" ]; then UV_INDEX="https://download.pytorch.org/whl/cpu"; \
elif [ "$GPU_DRIVER" = "rocm" ]; then UV_INDEX="https://download.pytorch.org/whl/rocm6.2"; \
# Cannot use the uv.lock as that is locked to CUDA version packages, which breaks rocm...
# --mount=type=bind,source=uv.lock,target=uv.lock \
ulimit -n 30000 && \
if [ "$TARGETPLATFORM" = "linux/arm64" ] || [ "$GPU_DRIVER" = "cpu" ]; then export UV_INDEX="$CPU_TORCH"; \
elif [ "$GPU_DRIVER" = "rocm" ]; then export UV_INDEX="$ROCM_TORCH"; \
else export UV_INDEX="$CUDA_TORCH"; \
fi && \
uv pip install -e .

4 changes: 2 additions & 2 deletions docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ run() {

# parse .env file for build args
build_args=$(awk '$1 ~ /=[^$]/ && $0 !~ /^#/ {print "--build-arg " $0 " "}' .env) &&
profile="$(awk -F '=' '/GPU_DRIVER/ {print $2}' .env)"
profile="$(awk -F '=' '/GPU_DRIVER=/ {print $2}' .env)"

# default to 'cuda' profile
[[ -z "$profile" ]] && profile="cuda"
Expand All @@ -30,7 +30,7 @@ run() {

printf "%s\n" "starting service $service_name"
docker compose --profile "$profile" up -d "$service_name"
docker compose logs -f
docker compose --profile "$profile" logs -f
}

run