Skip to content

Commit

Permalink
build: add docker build with Ceres 2 (mapillary#702)
Browse files Browse the repository at this point in the history
Summary:
Add a docker file that builds with Ceres 2. Add a github workflow to build and run tests on that dockerfile.

Pull Request resolved: mapillary#702

Reviewed By: YanNoun

Differential Revision: D26222552

Pulled By: paulinus

fbshipit-source-id: d0ba73062ed45f87a3c8740d3decd41aece8f300
  • Loading branch information
paulinus authored and facebook-github-bot committed Feb 3, 2021
1 parent 42c5f8f commit 1b864bd
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/docker_ceres2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Docker CI

on: [push, pull_request]

jobs:

build-test:
name: Build docker installing CeresSolver 2 and run tests
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
submodules: true

- name: Build the Docker image
run: docker build . --file Dockerfile.ceres2 --tag mapillary/opensfm.ceres2:$GITHUB_SHA

- name: Run C++ tests
run: docker run mapillary/opensfm.ceres2:$GITHUB_SHA /bin/sh -c "cd cmake_build && ctest"

- name: Run Python tests
run: docker run mapillary/opensfm.ceres2:$GITHUB_SHA python3 -m pytest
43 changes: 43 additions & 0 deletions Dockerfile.ceres2
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
FROM ubuntu:20.04

ARG DEBIAN_FRONTEND=noninteractive

# Install apt-getable dependencies
RUN apt-get update \
&& apt-get install -y \
build-essential \
cmake \
git \
libeigen3-dev \
libgoogle-glog-dev \
libopencv-dev \
libsuitesparse-dev \
python3-dev \
python3-numpy \
python3-opencv \
python3-pip \
python3-pyproj \
python3-scipy \
python3-yaml \
curl \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*


# Install Ceres 2
RUN \
mkdir -p /source && cd /source && \
curl -L http://ceres-solver.org/ceres-solver-2.0.0.tar.gz | tar xz && \
cd /source/ceres-solver-2.0.0 && \
mkdir -p build && cd build && \
cmake .. -DCMAKE_C_FLAGS=-fPIC -DCMAKE_CXX_FLAGS=-fPIC -DBUILD_EXAMPLES=OFF -DBUILD_TESTING=OFF && \
make -j4 install && \
cd / && rm -rf /source/ceres-solver-2.0.0


COPY . /source/OpenSfM

WORKDIR /source/OpenSfM

RUN pip3 install -r requirements.txt && \
python3 setup.py build

0 comments on commit 1b864bd

Please sign in to comment.