From 5d401e1a83226a8a53185627d87f38f8adde6fc9 Mon Sep 17 00:00:00 2001 From: Simon Alibert Date: Wed, 22 May 2024 11:29:22 +0200 Subject: [PATCH] Add dev build --- .github/workflows/build-docker-images.yml | 62 +++++++++++++++++++++++ docker/lerobot-gpu-dev/Dockerfile | 35 +++++++++++++ docker/lerobot-gpu/Dockerfile | 14 ++--- 3 files changed, 101 insertions(+), 10 deletions(-) create mode 100644 docker/lerobot-gpu-dev/Dockerfile diff --git a/.github/workflows/build-docker-images.yml b/.github/workflows/build-docker-images.yml index 45972ae8..36291a27 100644 --- a/.github/workflows/build-docker-images.yml +++ b/.github/workflows/build-docker-images.yml @@ -137,3 +137,65 @@ jobs: # } # env: # SLACK_BOT_TOKEN: ${{ secrets.SLACK_CIFEEDBACK_BOT_TOKEN }} + + latest-cuda-dev: + name: GPU Dev + runs-on: ubuntu-latest + steps: + - name: Cleanup disk + run: | + sudo df -h + # sudo ls -l /usr/local/lib/ + # sudo ls -l /usr/share/ + sudo du -sh /usr/local/lib/ + sudo du -sh /usr/share/ + sudo rm -rf /usr/local/lib/android + sudo rm -rf /usr/share/dotnet + sudo du -sh /usr/local/lib/ + sudo du -sh /usr/share/ + sudo df -h + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Check out code + uses: actions/checkout@v4 + + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + + - name: Build and Push GPU + uses: docker/build-push-action@v5 + with: + context: . + file: ./docker/lerobot-gpu-dev/Dockerfile + push: true + tags: huggingface/lerobot-gpu-dev + build-args: PYTHON_VERSION=${{ env.PYTHON_VERSION }} + + # - name: Post to a Slack channel + # id: slack + # #uses: slackapi/slack-github-action@v1.25.0 + # uses: slackapi/slack-github-action@6c661ce58804a1a20f6dc5fbee7f0381b469e001 + # with: + # # Slack channel id, channel name, or user id to post message. + # # See also: https://api.slack.com/methods/chat.postMessage#channels + # channel-id: ${{ env.CI_SLACK_CHANNEL }} + # # For posting a rich message using Block Kit + # payload: | + # { + # "text": "lerobot-gpu-dev Docker Image build result: ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}", + # "blocks": [ + # { + # "type": "section", + # "text": { + # "type": "mrkdwn", + # "text": "lerobot-gpu-dev Docker Image build result: ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}" + # } + # } + # ] + # } + # env: + # SLACK_BOT_TOKEN: ${{ secrets.SLACK_CIFEEDBACK_BOT_TOKEN }} diff --git a/docker/lerobot-gpu-dev/Dockerfile b/docker/lerobot-gpu-dev/Dockerfile new file mode 100644 index 00000000..000fbc0c --- /dev/null +++ b/docker/lerobot-gpu-dev/Dockerfile @@ -0,0 +1,35 @@ +FROM nvidia/cuda:12.4.1-base-ubuntu22.04 + +# Configure image +ARG PYTHON_VERSION=3.10 +ARG DEBIAN_FRONTEND=noninteractive + +# Install apt dependencies +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential cmake \ + git git-lfs openssh-client \ + nano vim ffmpeg \ + htop atop nvtop \ + sed gawk grep curl wget \ + tcpdump sysstat screen \ + libglib2.0-0 libgl1-mesa-glx libegl1-mesa \ + python${PYTHON_VERSION} python${PYTHON_VERSION}-venv \ + && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install gh cli tool +RUN (type -p wget >/dev/null || (apt update && apt-get install wget -y)) \ + && mkdir -p -m 755 /etc/apt/keyrings \ + && wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \ + && chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \ + && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \ + && apt update \ + && apt install gh -y + +# Setup `python` +RUN ln -s /usr/bin/python${PYTHON_VERSION} /usr/bin/python + +# Install poetry +RUN curl -sSL https://install.python-poetry.org | python - + +# Set EGL as the rendering backend for MuJoCo +ENV MUJOCO_GL="egl" diff --git a/docker/lerobot-gpu/Dockerfile b/docker/lerobot-gpu/Dockerfile index 4803ca33..2c36b484 100644 --- a/docker/lerobot-gpu/Dockerfile +++ b/docker/lerobot-gpu/Dockerfile @@ -4,29 +4,23 @@ FROM nvidia/cuda:12.4.1-base-ubuntu22.04 ARG PYTHON_VERSION=3.10 ARG DEBIAN_FRONTEND=noninteractive + # Install apt dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential cmake \ - git git-lfs openssh-client \ - nano vim ffmpeg \ - htop atop nvtop \ - sed gawk grep curl wget \ - tcpdump sysstat screen \ libglib2.0-0 libgl1-mesa-glx libegl1-mesa \ python${PYTHON_VERSION} python${PYTHON_VERSION}-venv \ && apt-get clean && rm -rf /var/lib/apt/lists/* -# Install poetry -RUN ln -s /usr/bin/python${PYTHON_VERSION} /usr/bin/python -RUN curl -sSL https://install.python-poetry.org | python - +# Create virtual environment +RUN ln -s /usr/bin/python${PYTHON_VERSION} /usr/bin/python RUN python -m venv /opt/venv ENV PATH="/opt/venv/bin:$PATH" RUN echo "source /opt/venv/bin/activate" >> /root/.bashrc # Install LeRobot -RUN git lfs install -RUN git clone https://github.com/huggingface/lerobot.git +COPY . /lerobot WORKDIR /lerobot RUN pip install --upgrade --no-cache-dir pip RUN pip install --no-cache-dir ".[test, aloha, xarm, pusht]"