blob: f5d2a5487b07da9c70e219059823ac0135219a45 [file] [log] [blame]
# Copyright 2022 Google LLC
#
# 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:22.04
# install system deps
RUN apt-get update && apt-get install -y build-essential wget vim libstdc++-10-dev \
git checkinstall zlib1g-dev curl protobuf-compiler cmake \
pkg-config libdbus-1-dev ninja-build libssl-dev default-jre default-jdk \
lsb-release wget software-properties-common gnupg clang
RUN apt upgrade -y
# Install node and npm following official instructions : https://github.com/nodesource/distributions/blob/master/README.md
RUN apt purge -y nodejs && apt autoremove
RUN curl -fsSL https://deb.nodesource.com/setup_18.x -o nodesource_setup.sh
RUN bash nodesource_setup.sh
RUN apt install -y nodejs
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
RUN apt-get -y install ./google-chrome-stable_current_amd64.deb
RUN export CHROME_BIN="/usr/bin/google-chrome-stable"
ENV CC=/usr/bin/clang
ENV CXX=/usr/bin/clang++
# install cargo with default settings
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
RUN rustup toolchain install 1.79.0 --component llvm-tools-preview
RUN rustup toolchain install nightly-2024-09-03 --component rust-src --force
RUN rustup target add wasm32-unknown-unknown # used by np_web
RUN rustup target add thumbv7m-none-eabi
RUN cargo install --locked cargo-deny --color never 2>&1
RUN cargo install --locked cargo-llvm-cov --color never 2>&1
RUN cargo install bindgen-cli --version 0.69.4 --color never 2>&1
RUN cargo install wasm-pack --color never 2>&1
# unreleased PR https://github.com/ehuss/cargo-prefetch/pull/6
RUN cargo install cargo-prefetch \
--git https://github.com/marshallpierce/cargo-prefetch.git \
--rev f6affa68e950275f9fd773f2646ab7ee4db82897 \
--color never 2>&1
# boringssl build wants go
RUN curl -L https://go.dev/dl/go1.20.2.linux-amd64.tar.gz | tar -C /usr/local -xz
ENV PATH="$PATH:/usr/local/go/bin"
# needed for boringssl git operations
RUN git config --global user.email "docker@example.com"
RUN git config --global user.name "NP Docker"
# Download google-java-format
RUN mkdir /opt/google-java-format
WORKDIR /opt/google-java-format
ENV GOOGLE_JAVA_FORMAT_VERSION="1.19.2"
RUN wget "https://github.com/google/google-java-format/releases/download/v${GOOGLE_JAVA_FORMAT_VERSION}/google-java-format-${GOOGLE_JAVA_FORMAT_VERSION}-all-deps.jar" -q -O "google-java-format-all-deps.jar"
RUN mkdir -p /beto-core
COPY . /beto-core
WORKDIR /beto-core
# prefetch dependencies so later build steps don't re-download on source changes
RUN cargo prefetch --lockfile nearby/Cargo.lock 2>&1
RUN cargo prefetch --lockfile common/Cargo.lock 2>&1
# when the image runs build and test everything to ensure env is setup correctly
WORKDIR /beto-core/nearby
CMD ["cargo", "run", "--", "run-all-checks"]