Skip to content

Commit

Permalink
Add Dockerfile for VLFM
Browse files Browse the repository at this point in the history
  • Loading branch information
jiuguangw committed Oct 16, 2023
1 parent 4a84511 commit 4f4fc39
Show file tree
Hide file tree
Showing 5 changed files with 167 additions and 21 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -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 <account>/<repo>
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
31 changes: 11 additions & 20 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -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
36 changes: 36 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -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/[email protected] \
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
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
41 changes: 40 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -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},
)

0 comments on commit 4f4fc39

Please sign in to comment.