diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..491ddb7 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,79 @@ +# Copyright (c) 2023 Boston Dynamics AI Institute LLC. All rights reserved. + +name: Docker - Build VLFM Docker + +on: + pull_request: + paths: + - ".github/workflows/docker.yml" + - "docker/**" + push: + branches: + - 'main' + paths: + - ".github/workflows/docker.yml" + - "docker/**" + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +env: + # Use docker.io for Docker Hub if empty + REGISTRY: ghcr.io + # github.repository as / + IMAGE_NAME: ghcr.io/bdaiinstitute/bdaii_vlfm + + +jobs: + build: + name: docker_vlfm + + runs-on: + group: bdai-gh-large-runners + permissions: + contents: read + packages: write + # This is used to complete the identity challenge + # with sigstore/fulcio when running outside of PRs. + id-token: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Workaround: https://github.com/docker/build-push-action/issues/461 + - name: Setup Docker buildx + uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf + + # Login against a Docker registry except on PR + # https://github.com/docker/login-action + - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' + uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Extract metadata (tags, labels) for Docker + # https://github.com/docker/metadata-action + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + # Build and push Docker image with Buildx (don't push on PR) + # https://github.com/docker/build-push-action + - name: Build and push Docker image + id: build-and-push + uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a + with: + context: ./docker + file: ./docker/Dockerfile + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8464618..6caa3c0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,31 +1,22 @@ # Copyright [2023] Boston Dynamics AI Institute, Inc. -name: ZSOS - Main Build - +name: VLFM CI on: - push: - branches: [ main ] pull_request: + push: + branches: + - main jobs: - build: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: ['3.9.16'] - os: [ubuntu-latest] + vlfm_main_build: + runs-on: ubuntu-latest + defaults: + run: + shell: bash + container: + image: ghcr.io/bdaiinstitute/bdaii_vlfm:main steps: - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Install package - run: | - sudo apt-get install -y libgl1-mesa-dev - pip install -e .[habitat] - pip install -e .[dev] - name: Pytest run: | pytest test diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..3a797d1 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,36 @@ +FROM ubuntu:22.04 + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update \ + && apt-get install --no-install-recommends -qy curl apt-transport-https gnupg \ + sudo ca-certificates git software-properties-common \ + build-essential \ + libgl1-mesa-dev libjpeg-dev libglm-dev libgl1-mesa-glx \ + libegl1-mesa-dev mesa-utils xorg-dev freeglut3-dev \ + python3.10-dev python3-pip python-is-python3 \ + && rm -rf /var/lib/apt/lists/* \ + && apt-get clean all + +# Install the required Python packages +RUN pip install torch>=1.10.1 \ + numpy>=1.22.4 \ + flask>=2.3.2 \ + seaborn>=0.12.2 \ + open3d>=0.17.0 \ + transformers==4.26.0 \ + salesforce-lavis>=1.0.2 \ + git+https://github.com/naokiyokoyama/frontier_exploration.git \ + git+https://github.com/ChaoningZhang/MobileSAM.git \ + git+https://github.com/naokiyokoyama/depth_camera_filtering \ + git+https://github.com/IDEA-Research/GroundingDINO.git \ + pre-commit>=3.1.1 \ + pytest>=7.2.1 \ + pytest-cov>=4.0.0 \ + git+https://github.com/facebookresearch/habitat-sim.git@v0.2.4 \ + habitat-baselines==0.2.420230405 \ + habitat-lab==0.2.420230405 \ + git+https://github.com/naokiyokoyama/bd_spot_wrapper.git \ + bosdyn-client>=3.3.2 \ + bosdyn-api>=3.3.2 \ + six>=1.16.0 diff --git a/pyproject.toml b/pyproject.toml index a00064a..1074931 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,6 +24,7 @@ dependencies = [ "frontier_exploration @ git+https://github.com/naokiyokoyama/frontier_exploration.git", "mobile_sam @ git+https://github.com/ChaoningZhang/MobileSAM.git", "depth_camera_filtering @ git+https://github.com/naokiyokoyama/depth_camera_filtering", + "groundingdino @ git+https://github.com/IDEA-Research/GroundingDINO.git", ] [project.optional-dependencies] diff --git a/setup.py b/setup.py index f44ef52..91662f4 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,44 @@ # Copyright [2023] Boston Dynamics AI Institute, Inc. +import subprocess +from pathlib import Path from setuptools import setup +from setuptools.command.develop import develop -setup() + +class GetYolov7(develop): + def run(self): + # Specify the URL of the Git repository you want to clone + git_repo_url = "https://github.com/WongKinYiu/yolov7.git" + + # Get the current project directory + project_directory = Path(__file__).resolve().parent + + # Clone the Git repository into the project directory + subprocess.run(["git", "clone", git_repo_url, str(project_directory)]) + + super().run() + + +# Read metadata and dependencies from pyproject.toml +pyproject = Path(__file__).resolve().parent / "pyproject.toml" +metadata = {} +install_requires = [] + +if pyproject.exists(): + import toml + + pyproject_data = toml.load(pyproject) + + if "project" in pyproject_data: + metadata = pyproject_data["project"] + + if "dependencies" in pyproject_data: + for dep in pyproject_data["dependencies"]: + install_requires.append(dep) + +setup( + **metadata, + install_requires=install_requires, + cmdclass={"develop": GetYolov7}, +)