diff --git a/.dockyman/Makefile b/.dockyman/Makefile index 97e2b5c..629248a 100644 --- a/.dockyman/Makefile +++ b/.dockyman/Makefile @@ -50,7 +50,7 @@ ENV_BUILD := --env-file ${ENV_FILE_BUILD} UNAME := $(shell uname) DOCKER_INSTALLED := $(shell command -v docker 2> /dev/null) DOCKER_COMPOSE_INSTALLED := $(shell command -v docker-compose 2> /dev/null) -NVIDIA_DOCKER_INSTALLED := $(shell command -v nvidia-docker 2> /dev/null) +NVIDIA_DOCKER_INSTALLED := $(shell command -v nvidia-container-toolkit 2> /dev/null) HAS_NVIDIA_GPU := $(shell lspci | grep -i nvidia) HAS_DOCKER_GROUP := $(shell groups $(USER) | grep -o '\bdocker\b') @@ -59,12 +59,24 @@ ifeq ($(UNAME), Linux) PACKAGE_MANAGER := apt-get DOCKER_INSTALL_CMD := curl -fsSL https://get.docker.com | sh DOCKER_COMPOSE_INSTALL_CMD := sudo curl -L "https://github.com/docker/compose/releases/download/v2.23.3/docker-compose-$(shell uname -s)-$(shell uname -m)" -o /usr/local/bin/docker-compose && sudo chmod +x /usr/local/bin/docker-compose - NVIDIA_DOCKER_INSTALL_CMD := distribution=$(. /etc/os-release;echo $ID$VERSION_ID) && curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - && curl -s -L https://nvidia.github.io/nvidia-docker/$$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list && sudo apt-get update && sudo apt-get install -y nvidia-docker2 && sudo systemctl restart docker + NVIDIA_DOCKER_INSTALL_CMD := \ + curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg ; \ + curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \ + sed 's\#deb https://\#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://\#g' | \ + sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list ; \ + sed -i -e '/experimental/ s/^\#//g' /etc/apt/sources.list.d/nvidia-container-toolkit.list ; \ + sudo apt-get update ; \ + sudo apt-get install -y nvidia-container-toolkit + else ifeq ($(shell cat /etc/os-release | grep '^ID=' | cut -d= -f2), centos) PACKAGE_MANAGER := yum DOCKER_INSTALL_CMD := sudo yum install -y docker-ce - DOCKER_COMPOSE_INSTALL_CMD := sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(shell uname -s)-$(shell uname -m)" -o /usr/local/bin/docker-compose && sudo chmod +x /usr/local/bin/docker-compose - NVIDIA_DOCKER_INSTALL_CMD := sudo yum install -y nvidia-docker2 + DOCKER_COMPOSE_INSTALL_CMD := sudo curl -L "https://github.com/docker/compose/releases/download/2.23.3/docker-compose-$(shell uname -s)-$(shell uname -m)" -o /usr/local/bin/docker-compose && sudo chmod +x /usr/local/bin/docker-compose + NVIDIA_DOCKER_INSTALL_CMD := curl -s -L https://nvidia.github.io/libnvidia-container/stable/rpm/nvidia-container-toolkit.repo | \ + sudo tee /etc/yum.repos.d/nvidia-container-toolkit.repo ; \ + sudo yum-config-manager --enable nvidia-container-toolkit-experimental ; \ + sudo yum install -y nvidia-container-toolkit + else ifeq ($(shell cat /etc/os-release | grep '^ID=' | cut -d= -f2), arch) PACKAGE_MANAGER := pacman DOCKER_INSTALL_CMD := sudo pacman -S --noconfirm docker @@ -211,6 +223,27 @@ uninstall-docker: ;; \ esac +.PHONY: uninstall-nvidia-docker +uninstall-nvidia-docker: + @read -p "This will uninstall NVIDIA Docker. Do you want to proceed? (y/N) " choice; \ + case "$$choice" in \ + y|Y) \ + echo "Uninstalling NVIDIA Docker..."; \ + if [ -z "$(HAS_NVIDIA_GPU)" ]; then \ + echo "No NVIDIA GPU detected. Skipping NVIDIA Docker uninstallation."; \ + else \ + if dpkg -l | grep -q nvidia-container-toolkit; then \ + sudo apt-get remove -y nvidia-container-toolkit; \ + echo "Uninstall complete."; \ + else \ + echo "NVIDIA Docker is not installed."; \ + fi; \ + fi; \ + ;; \ + *) \ + echo "Aborting uninstallation."; \ + ;; \ + esac .PHONY: help help: @@ -221,7 +254,8 @@ help: @echo " add-docker-group Add current user to the 'docker' group" @echo " reboot Reboot the machine" @echo " install-all Install Docker, Docker Compose, NVIDIA Docker, add user to 'docker' group, and reboot" - @echo " uninstall-docker Uninstall Docker, Docker Compose and NVIDIA Docker" + @echo " uninstall-docker Uninstall Docker, Docker Compose" + @echo " uninstall-nvidia-docker Uninstall NVIDIA Docker" @echo " help Display this help message" @@ -248,42 +282,66 @@ create_env: echo "GPU_PROFILE=no-gpu" >> ${ENV_FILE_RUN}; \ fi -build-base-nocache: stop +build-base-nocache: + ${DOCKYMAN_BASE_COMMAND} down --remove-orphans + ${DOCKYMAN_LOCAL_COMMAND} down --remove-orphans + @for service in $(DOCKYMAN_BASE_SERVICES); do \ echo "Building base image from service '$$service' ..."; \ set -e; \ ACTION=build_base_nocache ${DOCKYMAN_BASE_COMMAND} run $$service; \ done -build-base: stop +build-base: + ${DOCKYMAN_BASE_COMMAND} down --remove-orphans + ${DOCKYMAN_LOCAL_COMMAND} down --remove-orphans @for service in $(DOCKYMAN_BASE_SERVICES); do \ echo "Building base image from service '$$service' ..."; \ set -e; \ ACTION=build_base ${DOCKYMAN_BASE_COMMAND} run $$service; \ done -build-local: stop +remove-build-base: + ${DOCKYMAN_BASE_COMMAND} down --remove-orphans + ${DOCKYMAN_LOCAL_COMMAND} down --remove-orphans + @for service in $(DOCKYMAN_BASE_SERVICES); do \ + echo "Removing base image from service '$$service' ..."; \ + set -e; \ + ACTION=clean_base ${DOCKYMAN_BASE_COMMAND} run $$service; \ + done + +build-local: + ${DOCKYMAN_BASE_COMMAND} down --remove-orphans + ${DOCKYMAN_LOCAL_COMMAND} down --remove-orphans @for service in $(DOCKYMAN_LOCAL_SERVICES); do \ echo "Building local image from service '$$service' ..."; \ set -e; \ ACTION=build_local ${DOCKYMAN_LOCAL_COMMAND} run $$service; \ done -pull: stop +pull: + ${DOCKYMAN_BASE_COMMAND} down --remove-orphans + ${DOCKYMAN_LOCAL_COMMAND} down --remove-orphans @for service in $(DOCKYMAN_BASE_SERVICES); do \ echo "Pulling base image from service '$$service' ..."; \ set -e; \ ACTION=pull ${DOCKYMAN_BASE_COMMAND} run $$service; \ done -push: stop +push: + ${DOCKYMAN_BASE_COMMAND} down --remove-orphans + ${DOCKYMAN_LOCAL_COMMAND} down --remove-orphans + @for service in $(DOCKYMAN_BASE_SERVICES); do \ echo "Pushing base image from service '$$service' ..."; \ set -e; \ ACTION=push ${DOCKYMAN_BASE_COMMAND} run $$service; \ done -clean: stop +clean: + ${DOCKYMAN_BASE_COMMAND} down --remove-orphans + ${DOCKYMAN_LOCAL_COMMAND} down --remove-orphans + @echo "Cleaning volumes ..."; @${DOCKYMAN_LOCAL_COMMAND} down -v; @echo "Removing env ${ENV_FILE_RUN} ... "; @@ -304,7 +362,7 @@ dev: @echo "DEVELOPMENT PROFILE updated in ${ENV_FILE_BUILD}"; $(MAKE) create_env; -production: +production: remove-build-base @echo "Configuring PRODUCTION PROFILE..." @if grep -q '^PROFILE=' ${ENV_FILE_BUILD}; then \ sed -i 's/^PROFILE=.*/PROFILE=production/' ${ENV_FILE_BUILD}; \ @@ -313,12 +371,12 @@ production: fi; @echo "PRODUCTION PROFILE updated in ${ENV_FILE_BUILD}"; \ $(MAKE) create_env; - init-host: bash ${SCRIPTS}/initHost.sh build: build-base build-local + @docker network prune -f rebuild: clean build-base-nocache build-local @@ -335,7 +393,6 @@ dockyman-run: run: default log init-host dockyman-run stop clean-docker: - @docker container prune -f @docker network prune -f - @docker image prune -af + @docker system prune -af @docker volume prune -f \ No newline at end of file diff --git a/.dockyman/services/dockyman.yaml b/.dockyman/services/dockyman.yaml index 77c51f9..2b51ef0 100644 --- a/.dockyman/services/dockyman.yaml +++ b/.dockyman/services/dockyman.yaml @@ -25,7 +25,7 @@ services: dockyman: - image: iitschri/dockyman:${DOCKYMAN_VER:?err} + image: iitschri/dockyman:${DOCKYMAN_VER} volumes: - /var/run/docker.sock:/var/run/docker.sock:ro diff --git a/base/pyicub-frontend/Dockerfile b/base/pyicub-frontend/Dockerfile index 05ae1d2..d89205a 100644 --- a/base/pyicub-frontend/Dockerfile +++ b/base/pyicub-frontend/Dockerfile @@ -32,6 +32,7 @@ RUN git clone https://github.com/s4hri/pyicub-frontend -b master tmp RUN cd tmp && git checkout ${PYICUB_FRONTEND_VERSION} RUN cp -a tmp/. /app/pyicub-frontend/ RUN rm -rf tmp + # Define work directory WORKDIR /app/pyicub-frontend RUN npm install diff --git a/build.env b/build.env index df74610..494ba46 100644 --- a/build.env +++ b/build.env @@ -1,13 +1,13 @@ -DOCKYMAN_VER=v1.1 +DOCKYMAN_VER=v1.2 REPOSITORY=iitschri PROFILE=development -VERSION=v7.6-ng +VERSION=v7.7-ng -ICUB_DISTRO=v2022.02.0-ubuntu20.04 +ICUB_DISTRO=v2022.09.1 PYICUB_BASE_DOCKER_SRC=${REPOSITORY}/robotology-superbuild-docker:${ICUB_DISTRO} PYICUB_BASE_NAME=${REPOSITORY}/pyicub-docker:${VERSION} -PYICUB_VERSION=v7.6-distro_v2022.02.0-ubuntu20.04 +PYICUB_VERSION=v7.7-distro_v2022.09.1 PYICUB_FRONTEND_VERSION=v8.0-ng PYICUB_FRONTEND_BASE_NAME=${REPOSITORY}/pyicub-frontend-docker:${PYICUB_FRONTEND_VERSION} diff --git a/compose.yaml b/compose.yaml index 6a33861..371e449 100644 --- a/compose.yaml +++ b/compose.yaml @@ -12,6 +12,7 @@ services: env_file: - .env + - icub.env - pyicub.env command: ["/bin/bash", "-c", "terminator & bash /var/dockyman/scripts/initContainer.sh"] diff --git a/icub.env b/icub.env new file mode 100644 index 0000000..ce4326b --- /dev/null +++ b/icub.env @@ -0,0 +1,13 @@ +# iCub configuration +ICUB_SIMULATION=true +ICUB_USER=icub +ICUB_PSW=icub +ICUB_HOST=icub-head +ICUB_IP=10.0.0.2 +ICUBSRV_HOST=icubsrv +ICUBSRV_IP=10.0.0.1 +ICUBSRV_PORT=10000 +ICUB_APPS=/workdir + +# YARP configuration +YARP_FORWARD_LOG_ENABLE=1 \ No newline at end of file diff --git a/pyicub.env b/pyicub.env index 017b00f..ea51afa 100644 --- a/pyicub.env +++ b/pyicub.env @@ -1,18 +1,3 @@ -# iCub configuration -ICUB_SIMULATION=true -ICUB_USER=icub -ICUB_PSW=icub -ICUB_HOST=icub-head -ICUB_IP=10.0.0.2 -ICUBSRV_HOST=icubsrv -ICUBSRV_IP=10.0.0.1 -ICUBSRV_PORT=10000 -ICUB_APPS=/workdir/apps - -# YARP configuration -YARP_FORWARD_LOG_ENABLE=1 - -# API configuration PYICUB_LOGGING=true PYICUB_LOGGING_PATH=/workdir/logs PYICUB_API=true @@ -23,4 +8,3 @@ REACT_APP_NAME=pywebapp PORT=${PYICUB_API_FRONTEND_PORT} REACT_APP_API=pyicub REACT_APP_PROXY=http://${PYICUB_API_PROXY_HOST}:${PYICUB_API_PROXY_PORT} -REACT_APP_ICUB_SIMULATION=${ICUB_SIMULATION}