forked from Haidra-Org/horde-worker-reGen
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from AIPowerGrid/urek
Upgrading
- Loading branch information
Showing
41 changed files
with
1,145 additions
and
323 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
ignored: | ||
- DL3008 # Pin versions in apt get install | ||
- DL3042 # Avoid cache directory with `pip install` | ||
- DL3002 # Last USER should not be root | ||
failure-threshold: warning |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Stage 1: Base environment setup | ||
ARG CUDA_VERSION=12.4.1 | ||
FROM nvidia/cuda:${CUDA_VERSION}-runtime-ubuntu22.04 AS base | ||
|
||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
|
||
ARG DEBIAN_FRONTEND=noninteractive | ||
ARG PYTHON_VERSION=3.11 | ||
ENV PYTHON_VERSION=${PYTHON_VERSION} | ||
ENV APP_HOME=/horde-worker-reGen | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends software-properties-common && \ | ||
add-apt-repository ppa:deadsnakes/ppa && \ | ||
apt-get install -y --no-install-recommends \ | ||
python${PYTHON_VERSION} \ | ||
python3-pip \ | ||
python${PYTHON_VERSION}-venv \ | ||
libgl1 \ | ||
git && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Extract CUDA version for PyTorch | ||
ARG CUDA_VERSION | ||
RUN CUDA_VERSION_SHORT=$(echo "${CUDA_VERSION}" | cut -d. -f1-2 | tr -d '.') && \ | ||
echo "${CUDA_VERSION_SHORT}" && \ | ||
echo "export CUDA_VERSION_SHORT=${CUDA_VERSION_SHORT}" >> /env_vars | ||
|
||
# Stage 2: Clone repository and install dependencies | ||
FROM base AS builder | ||
|
||
ARG GIT_BRANCH=main | ||
ARG GIT_OWNER=Haidra-Org | ||
|
||
RUN echo "export GIT_BRANCH=${GIT_BRANCH}" >> /env_vars && \ | ||
echo "export GIT_OWNER=${GIT_OWNER}" >> /env_vars | ||
|
||
WORKDIR "${APP_HOME}" | ||
|
||
# Clone the repository | ||
RUN git clone "https://github.com/${GIT_OWNER}/horde-worker-reGen.git" . && \ | ||
git switch "${GIT_BRANCH}" | ||
|
||
# Create virtual environment | ||
RUN python"${PYTHON_VERSION}" -m venv "${APP_HOME}/venv" | ||
ENV PATH="${APP_HOME}/venv/bin:$PATH" | ||
|
||
# Install dependencies | ||
ARG PIP_CACHE_DIR=/pip-cache | ||
ARG USE_PIP_CACHE=true | ||
|
||
RUN --mount=type=cache,target="${PIP_CACHE_DIR}",sharing=locked,id=pip-cache \ | ||
. /env_vars && \ | ||
if [ "${USE_PIP_CACHE}" = "true" ]; then \ | ||
pip install --cache-dir="${PIP_CACHE_DIR}" opencv-python-headless -r requirements.txt -U --extra-index-url "https://download.pytorch.org/whl/cu${CUDA_VERSION_SHORT}"; \ | ||
else \ | ||
pip install opencv-python-headless -r requirements.txt -U --extra-index-url "https://download.pytorch.org/whl/cu${CUDA_VERSION_SHORT}"; \ | ||
fi | ||
|
||
# Stage 3: Final stage | ||
FROM builder AS final | ||
|
||
WORKDIR "${APP_HOME}" | ||
COPY entrypoint.sh /entrypoint.sh | ||
COPY setup_*.sh "${APP_HOME}" | ||
RUN chmod +x /entrypoint.sh | ||
|
||
STOPSIGNAL SIGINT | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# Stage 1: Base environment setup | ||
ARG ROCM_VERSION=6.1.2 | ||
FROM rocm/rocm-terminal:${ROCM_VERSION} AS base | ||
|
||
USER root | ||
WORKDIR / | ||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
|
||
ARG DEBIAN_FRONTEND=noninteractive | ||
ARG PYTHON_VERSION=3.11 | ||
ENV PYTHON_VERSION=${PYTHON_VERSION} | ||
ENV APP_HOME=/horde-worker-reGen | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends software-properties-common && \ | ||
add-apt-repository ppa:deadsnakes/ppa && \ | ||
apt-get install -y --no-install-recommends \ | ||
python${PYTHON_VERSION} \ | ||
python3-pip \ | ||
python${PYTHON_VERSION}-venv \ | ||
python${PYTHON_VERSION}-dev \ | ||
python${PYTHON_VERSION}-distutils \ | ||
ninja-build \ | ||
rocm \ | ||
git && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Extract ROCm version for PyTorch | ||
ARG ROCM_VERSION | ||
RUN ROCM_VERSION_SHORT=$(echo "${ROCM_VERSION}" | cut -d. -f1-2) && \ | ||
echo "export ROCM_VERSION_SHORT=${ROCM_VERSION_SHORT}" >> /env_vars | ||
|
||
# Stage 2: Clone repository and install dependencies | ||
FROM base AS builder | ||
|
||
ARG GIT_BRANCH=main | ||
ARG GIT_OWNER=Haidra-Org | ||
|
||
RUN echo "export GIT_BRANCH=${GIT_BRANCH}" >> /env_vars && \ | ||
echo "export GIT_OWNER=${GIT_OWNER}" >> /env_vars | ||
|
||
WORKDIR "${APP_HOME}" | ||
|
||
# Clone the repository | ||
RUN git clone "https://github.com/${GIT_OWNER}/horde-worker-reGen.git" . && \ | ||
git switch "${GIT_BRANCH}" | ||
|
||
# Create virtual environment | ||
RUN python"${PYTHON_VERSION}" -m venv "${APP_HOME}/venv" | ||
ENV PATH="${APP_HOME}/venv/bin:$PATH" | ||
|
||
# Install dependencies | ||
ARG PIP_CACHE_DIR=/pip-cache | ||
ARG USE_PIP_CACHE=true | ||
|
||
RUN --mount=type=cache,target="${PIP_CACHE_DIR}",sharing=locked,id=pip-cache \ | ||
. /env_vars && \ | ||
if [ "${USE_PIP_CACHE}" = "true" ]; then \ | ||
pip install --cache-dir="${PIP_CACHE_DIR}" opencv-python-headless -r requirements.rocm.txt -U --extra-index-url "https://download.pytorch.org/whl/rocm${ROCM_VERSION_SHORT}"; \ | ||
else \ | ||
pip install opencv-python-headless -r requirements.rocm.txt -U --extra-index-url "https://download.pytorch.org/whl/rocm${ROCM_VERSION_SHORT}"; \ | ||
fi && \ | ||
pip uninstall -y pynvml nvidia-ml-py | ||
# Stage 3: Final stage | ||
FROM builder AS final | ||
|
||
WORKDIR "${APP_HOME}" | ||
COPY entrypoint.sh /entrypoint.sh | ||
COPY setup_*.sh "${APP_HOME}" | ||
RUN chmod +x /entrypoint.sh | ||
|
||
STOPSIGNAL SIGINT | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] |
Oops, something went wrong.