From f1616e16ec3b779b516dc1953dabce94144d582e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Sch=C3=BCtte?= Date: Tue, 23 Jan 2018 10:50:51 +0100 Subject: [PATCH] Introduce bazel docker file (#838) --- Dockerfile.jessie | 6 ++-- Dockerfile.stretch | 6 ++-- Dockerfile.trusty | 6 ++-- Dockerfile.trusty.bazel | 19 +++++++++++ Dockerfile.xenial | 6 ++-- docs/source/index.rst | 4 +-- scripts/install_cartographer_bazel.sh | 23 +++++++++++++ ...apher.sh => install_cartographer_cmake.sh} | 0 ...> install_cartographer_cmake_with_grpc.sh} | 0 scripts/install_debs_bazel.sh | 33 +++++++++++++++++++ ...{install_debs.sh => install_debs_cmake.sh} | 0 11 files changed, 89 insertions(+), 14 deletions(-) create mode 100644 Dockerfile.trusty.bazel create mode 100755 scripts/install_cartographer_bazel.sh rename scripts/{install_cartographer.sh => install_cartographer_cmake.sh} (100%) rename scripts/{install_cartographer_with_grpc.sh => install_cartographer_cmake_with_grpc.sh} (100%) create mode 100755 scripts/install_debs_bazel.sh rename scripts/{install_debs.sh => install_debs_cmake.sh} (100%) diff --git a/Dockerfile.jessie b/Dockerfile.jessie index 27ecfb9..c67abc1 100644 --- a/Dockerfile.jessie +++ b/Dockerfile.jessie @@ -17,11 +17,11 @@ FROM debian:jessie # This base image doesn't ship with sudo. RUN apt-get update && apt-get install -y sudo && rm -rf /var/lib/apt/lists/* -COPY scripts/install_debs.sh cartographer/scripts/ -RUN cartographer/scripts/install_debs.sh && rm -rf /var/lib/apt/lists/* +COPY scripts/install_debs_cmake.sh cartographer/scripts/ +RUN cartographer/scripts/install_debs_cmake.sh && rm -rf /var/lib/apt/lists/* COPY scripts/install_ceres.sh cartographer/scripts/ RUN cartographer/scripts/install_ceres.sh && rm -rf ceres-solver COPY scripts/install_proto3.sh cartographer/scripts/ RUN cartographer/scripts/install_proto3.sh && rm -rf protobuf COPY . cartographer -RUN cartographer/scripts/install_cartographer.sh && rm -rf cartographer +RUN cartographer/scripts/install_cartographer_cmake.sh && rm -rf cartographer diff --git a/Dockerfile.stretch b/Dockerfile.stretch index 6dece4e..7cdd617 100644 --- a/Dockerfile.stretch +++ b/Dockerfile.stretch @@ -17,11 +17,11 @@ FROM debian:stretch # This base image doesn't ship with sudo. RUN apt-get update && apt-get install -y sudo && rm -rf /var/lib/apt/lists/* -COPY scripts/install_debs.sh cartographer/scripts/ -RUN cartographer/scripts/install_debs.sh && rm -rf /var/lib/apt/lists/* +COPY scripts/install_debs_cmake.sh cartographer/scripts/ +RUN cartographer/scripts/install_debs_cmake.sh && rm -rf /var/lib/apt/lists/* COPY scripts/install_ceres.sh cartographer/scripts/ RUN cartographer/scripts/install_ceres.sh && rm -rf ceres-solver COPY scripts/install_proto3.sh cartographer/scripts/ RUN cartographer/scripts/install_proto3.sh && rm -rf protobuf COPY . cartographer -RUN cartographer/scripts/install_cartographer.sh && rm -rf cartographer +RUN cartographer/scripts/install_cartographer_cmake.sh && rm -rf cartographer diff --git a/Dockerfile.trusty b/Dockerfile.trusty index 3a03254..b80ba0e 100644 --- a/Dockerfile.trusty +++ b/Dockerfile.trusty @@ -13,8 +13,8 @@ # limitations under the License. FROM ubuntu:trusty -COPY scripts/install_debs.sh cartographer/scripts/ -RUN cartographer/scripts/install_debs.sh && rm -rf /var/lib/apt/lists/* +COPY scripts/install_debs_cmake.sh cartographer/scripts/ +RUN cartographer/scripts/install_debs_cmake.sh && rm -rf /var/lib/apt/lists/* COPY scripts/install_ceres.sh cartographer/scripts/ RUN cartographer/scripts/install_ceres.sh && rm -rf ceres-solver COPY scripts/install_proto3.sh cartographer/scripts/ @@ -22,4 +22,4 @@ RUN cartographer/scripts/install_proto3.sh && rm -rf protobuf COPY scripts/install_grpc.sh cartographer/scripts/ RUN cartographer/scripts/install_grpc.sh && rm -rf grpc COPY . cartographer -RUN cartographer/scripts/install_cartographer_with_grpc.sh && rm -rf cartographer +RUN cartographer/scripts/install_cartographer_cmake_with_grpc.sh && rm -rf cartographer diff --git a/Dockerfile.trusty.bazel b/Dockerfile.trusty.bazel new file mode 100644 index 0000000..8c5dc37 --- /dev/null +++ b/Dockerfile.trusty.bazel @@ -0,0 +1,19 @@ +# Copyright 2016 The Cartographer Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM ubuntu:trusty +COPY scripts/install_debs_bazel.sh cartographer/scripts/ +RUN cartographer/scripts/install_debs_bazel.sh && rm -rf /var/lib/apt/lists/* +COPY . cartographer +RUN cartographer/scripts/install_cartographer_bazel.sh && rm -rf cartographer diff --git a/Dockerfile.xenial b/Dockerfile.xenial index 9d68072..7279043 100644 --- a/Dockerfile.xenial +++ b/Dockerfile.xenial @@ -17,11 +17,11 @@ FROM ubuntu:xenial # This base image doesn't ship with sudo. RUN apt-get update && apt-get install -y sudo && rm -rf /var/lib/apt/lists/* -COPY scripts/install_debs.sh cartographer/scripts/ -RUN cartographer/scripts/install_debs.sh && rm -rf /var/lib/apt/lists/* +COPY scripts/install_debs_cmake.sh cartographer/scripts/ +RUN cartographer/scripts/install_debs_cmake.sh && rm -rf /var/lib/apt/lists/* COPY scripts/install_ceres.sh cartographer/scripts/ RUN cartographer/scripts/install_ceres.sh && rm -rf ceres-solver COPY scripts/install_proto3.sh cartographer/scripts/ RUN cartographer/scripts/install_proto3.sh && rm -rf protobuf COPY . cartographer -RUN cartographer/scripts/install_cartographer.sh && rm -rf cartographer +RUN cartographer/scripts/install_cartographer_cmake.sh && rm -rf cartographer diff --git a/docs/source/index.rst b/docs/source/index.rst index 1aab66c..ce3a34b 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -64,7 +64,7 @@ with the standalone library. Currently, it is the best available reference. On Ubuntu 14.04 (Trusty): -.. literalinclude:: ../../scripts/install_debs.sh +.. literalinclude:: ../../scripts/install_debs_cmake.sh :language: bash :lines: 20- @@ -76,7 +76,7 @@ On Ubuntu 14.04 (Trusty): :language: bash :lines: 20- -.. literalinclude:: ../../scripts/install_cartographer.sh +.. literalinclude:: ../../scripts/install_cartographer_cmake.sh :language: bash :lines: 20- diff --git a/scripts/install_cartographer_bazel.sh b/scripts/install_cartographer_bazel.sh new file mode 100755 index 0000000..e501780 --- /dev/null +++ b/scripts/install_cartographer_bazel.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +# Copyright 2016 The Cartographer Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -o errexit +set -o verbose + +# Build and install Cartographer. +cd cartographer +bazel build //... +bazel test //... diff --git a/scripts/install_cartographer.sh b/scripts/install_cartographer_cmake.sh similarity index 100% rename from scripts/install_cartographer.sh rename to scripts/install_cartographer_cmake.sh diff --git a/scripts/install_cartographer_with_grpc.sh b/scripts/install_cartographer_cmake_with_grpc.sh similarity index 100% rename from scripts/install_cartographer_with_grpc.sh rename to scripts/install_cartographer_cmake_with_grpc.sh diff --git a/scripts/install_debs_bazel.sh b/scripts/install_debs_bazel.sh new file mode 100755 index 0000000..f3b6883 --- /dev/null +++ b/scripts/install_debs_bazel.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +# Copyright 2016 The Cartographer Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -o errexit +set -o verbose + +# Install the required libraries that are available as debs. +sudo apt-get update +sudo apt-get install -y \ + wget \ + pkg-config \ + zip \ + g++ \ + zlib1g-dev \ + unzip \ + python +wget https://github.com/bazelbuild/bazel/releases/download/0.9.0/bazel-0.9.0-installer-linux-x86_64.sh +chmod +x bazel-0.9.0-installer-linux-x86_64.sh +./bazel-0.9.0-installer-linux-x86_64.sh +export PATH="$PATH:$HOME/bin" diff --git a/scripts/install_debs.sh b/scripts/install_debs_cmake.sh similarity index 100% rename from scripts/install_debs.sh rename to scripts/install_debs_cmake.sh