1# Copyright 2022 Google LLC 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15FROM ubuntu:22.10 16 17# install system deps 18RUN apt-get update && apt-get install -y build-essential cmake gcc wget vim \ 19clang git checkinstall zlib1g-dev rapidjson-dev libbenchmark-dev curl \ 20protobuf-compiler pkg-config libdbus-1-dev libssl-dev ninja-build 21RUN apt upgrade -y 22 23# install cargo with default settings 24RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.68.1 25ENV PATH="/root/.cargo/bin:${PATH}" 26RUN cargo install --locked cargo-deny --color never 2>&1 27RUN cargo install cargo-fuzz --color never 2>&1 28# unreleased PR https://github.com/ehuss/cargo-prefetch/pull/6 29RUN cargo install cargo-prefetch \ 30 --git https://github.com/marshallpierce/cargo-prefetch.git \ 31 --rev f6affa68e950275f9fd773f2646ab7ee4db82897 \ 32 --color never 2>&1 33# needed for generating boringssl bindings 34RUN cargo install bindgen-cli 35RUN rustup toolchain add nightly 36RUN curl -L https://go.dev/dl/go1.20.2.linux-amd64.tar.gz | tar -C /usr/local -xz 37ENV PATH="$PATH:/usr/local/go/bin" 38RUN go install github.com/google/addlicense@latest 39 40# when the image runs build and test everything to ensure env is setup correctly 41CMD ["./scripts/check-everything.sh"] 42 43# needed for boringssl git operations 44RUN git config --global user.email "docker@example.com" 45RUN git config --global user.name "NP Docker" 46 47RUN mkdir -p /google/nearby 48WORKDIR /google/nearby 49 50# prefetch dependencies so later build steps don't re-download on source changes 51COPY Cargo.toml Cargo.lock ./ 52RUN cargo prefetch --lockfile Cargo.lock 53 54# copy repo into workdir of docker containter 55COPY . . 56 57