2022-01-09 15:17:36 -05:00
|
|
|
VERSION 0.6
|
|
|
|
|
|
|
|
# Start with older Ubuntu to ensure GLIBC symbol versioning support for older linux
|
|
|
|
# Ensure we are using an amd64 platform because some of these targets use cross-platform tooling
|
|
|
|
FROM --platform amd64 ubuntu:16.04
|
|
|
|
|
|
|
|
# Install build prerequisites
|
|
|
|
deps-base:
|
|
|
|
RUN apt-get -y update
|
2022-11-02 20:42:07 -04:00
|
|
|
RUN apt-get install -y iproute2 curl build-essential cmake libssl-dev openssl file git pkg-config libdbus-1-dev libdbus-glib-1-dev libgirepository1.0-dev libcairo2-dev checkinstall unzip
|
2022-01-09 15:17:36 -05:00
|
|
|
|
2022-01-10 22:36:54 -05:00
|
|
|
# Install Cap'n Proto
|
|
|
|
deps-capnp:
|
|
|
|
FROM +deps-base
|
|
|
|
COPY scripts/earthly/install_capnproto.sh /
|
|
|
|
RUN /bin/bash /install_capnproto.sh; rm /install_capnproto.sh
|
|
|
|
|
2022-11-02 20:42:07 -04:00
|
|
|
# Install protoc
|
|
|
|
deps-protoc:
|
|
|
|
FROM +deps-capnp
|
|
|
|
COPY scripts/earthly/install_protoc.sh /
|
|
|
|
RUN /bin/bash /install_protoc.sh; rm /install_protoc.sh
|
|
|
|
|
2022-01-09 15:17:36 -05:00
|
|
|
# Install Rust
|
|
|
|
deps-rust:
|
2022-11-02 20:42:07 -04:00
|
|
|
FROM +deps-protoc
|
2022-01-09 15:17:36 -05:00
|
|
|
ENV RUSTUP_HOME=/usr/local/rustup
|
|
|
|
ENV CARGO_HOME=/usr/local/cargo
|
|
|
|
ENV PATH=/usr/local/cargo/bin:$PATH
|
|
|
|
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -c clippy --no-modify-path --profile minimal
|
|
|
|
RUN chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
|
|
|
|
rustup --version; \
|
|
|
|
cargo --version; \
|
|
|
|
rustc --version;
|
|
|
|
# ARM64 Linux
|
|
|
|
RUN rustup target add aarch64-unknown-linux-gnu
|
|
|
|
# Android
|
|
|
|
RUN rustup target add aarch64-linux-android
|
|
|
|
RUN rustup target add armv7-linux-androideabi
|
|
|
|
RUN rustup target add i686-linux-android
|
|
|
|
RUN rustup target add x86_64-linux-android
|
|
|
|
# WASM
|
|
|
|
RUN rustup target add wasm32-unknown-unknown
|
|
|
|
|
2022-01-11 21:48:37 -05:00
|
|
|
# Install Linux cross-platform tooling
|
2022-01-10 22:36:54 -05:00
|
|
|
deps-cross:
|
2022-01-09 15:17:36 -05:00
|
|
|
FROM +deps-rust
|
2022-01-11 21:48:37 -05:00
|
|
|
RUN apt-get install -y gcc-aarch64-linux-gnu curl unzip
|
2022-01-09 15:17:36 -05:00
|
|
|
|
2022-01-11 21:48:37 -05:00
|
|
|
# Install android tooling
|
|
|
|
deps-android:
|
|
|
|
FROM +deps-cross
|
|
|
|
RUN apt-get install -y openjdk-9-jdk-headless
|
|
|
|
RUN mkdir /Android; mkdir /Android/Sdk
|
|
|
|
RUN curl -o /Android/cmdline-tools.zip https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip
|
|
|
|
RUN cd /Android; unzip /Android/cmdline-tools.zip
|
|
|
|
RUN yes | /Android/cmdline-tools/bin/sdkmanager --sdk_root=/Android/Sdk build-tools\;30.0.3 ndk\;22.0.7026061 cmake\;3.18.1 platform-tools platforms\;android-30
|
2022-11-02 20:42:07 -04:00
|
|
|
RUN apt-get clean
|
2022-01-11 21:48:37 -05:00
|
|
|
|
2022-11-02 20:42:07 -04:00
|
|
|
# Just linux build not android
|
|
|
|
deps-linux:
|
|
|
|
FROM +deps-cross
|
2022-01-09 15:17:36 -05:00
|
|
|
RUN apt-get clean
|
|
|
|
|
2022-11-02 20:42:07 -04:00
|
|
|
# Code + Linux deps
|
|
|
|
code-linux:
|
|
|
|
FROM +deps-linux
|
|
|
|
COPY --dir .cargo external files scripts veilid-cli veilid-core veilid-server veilid-flutter veilid-wasm Cargo.lock Cargo.toml /veilid
|
2022-11-29 22:51:51 -05:00
|
|
|
RUN cat /veilid/scripts/earthly/cargo-linux/config.toml >> /veilid/.cargo/config.tml
|
2022-11-02 20:42:07 -04:00
|
|
|
WORKDIR /veilid
|
|
|
|
|
|
|
|
# Code + Linux + Android deps
|
|
|
|
code-android:
|
|
|
|
FROM +deps-android
|
2022-05-16 11:52:48 -04:00
|
|
|
COPY --dir .cargo external files scripts veilid-cli veilid-core veilid-server veilid-flutter veilid-wasm Cargo.lock Cargo.toml /veilid
|
2022-11-29 22:51:51 -05:00
|
|
|
RUN cat /veilid/scripts/earthly/cargo-linux/config.toml >> /veilid/.cargo/config.tml
|
|
|
|
RUN cat /veilid/scripts/earthly/cargo-android/config.toml >> /veilid/.cargo/config.tml
|
2022-01-11 21:48:37 -05:00
|
|
|
WORKDIR /veilid
|
2022-01-09 15:17:36 -05:00
|
|
|
|
|
|
|
# Clippy only
|
|
|
|
clippy:
|
2022-11-02 20:42:07 -04:00
|
|
|
FROM +code-linux
|
2022-01-09 15:17:36 -05:00
|
|
|
RUN cargo clippy
|
|
|
|
|
|
|
|
# Build
|
|
|
|
build-linux-amd64:
|
2022-11-02 20:42:07 -04:00
|
|
|
FROM +code-linux
|
2022-01-09 15:17:36 -05:00
|
|
|
RUN cargo build --target x86_64-unknown-linux-gnu --release
|
|
|
|
SAVE ARTIFACT ./target/x86_64-unknown-linux-gnu AS LOCAL ./target/artifacts/x86_64-unknown-linux-gnu
|
|
|
|
|
|
|
|
build-linux-arm64:
|
2022-11-02 20:42:07 -04:00
|
|
|
FROM +code-linux
|
2022-01-09 15:17:36 -05:00
|
|
|
RUN cargo build --target aarch64-unknown-linux-gnu --release
|
|
|
|
SAVE ARTIFACT ./target/aarch64-unknown-linux-gnu AS LOCAL ./target/artifacts/aarch64-unknown-linux-gnu
|
|
|
|
|
2022-01-11 21:48:37 -05:00
|
|
|
build-android:
|
2022-11-02 20:42:07 -04:00
|
|
|
FROM +code-android
|
2022-01-11 21:48:37 -05:00
|
|
|
WORKDIR /veilid/veilid-core
|
|
|
|
ENV PATH=$PATH:/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/bin/
|
|
|
|
RUN cargo build --target aarch64-linux-android --release
|
|
|
|
RUN cargo build --target armv7-linux-androideabi --release
|
|
|
|
RUN cargo build --target i686-linux-android --release
|
|
|
|
RUN cargo build --target x86_64-linux-android --release
|
|
|
|
WORKDIR /veilid
|
|
|
|
SAVE ARTIFACT ./target/aarch64-linux-android AS LOCAL ./target/artifacts/aarch64-linux-android
|
|
|
|
SAVE ARTIFACT ./target/armv7-linux-androideabi AS LOCAL ./target/artifacts/armv7-linux-androideabi
|
|
|
|
SAVE ARTIFACT ./target/i686-linux-android AS LOCAL ./target/artifacts/i686-linux-android
|
|
|
|
SAVE ARTIFACT ./target/x86_64-linux-android AS LOCAL ./target/artifacts/x86_64-linux-android
|
|
|
|
|
2022-01-09 15:17:36 -05:00
|
|
|
# Unit tests
|
2022-01-10 22:36:54 -05:00
|
|
|
unit-tests-linux-amd64:
|
2022-11-02 20:42:07 -04:00
|
|
|
FROM +code-linux
|
2022-01-10 22:36:54 -05:00
|
|
|
RUN cargo test --target x86_64-unknown-linux-gnu --release
|
|
|
|
|
|
|
|
unit-tests-linux-arm64:
|
2022-11-02 20:42:07 -04:00
|
|
|
FROM +code-linux
|
2022-01-10 22:36:54 -05:00
|
|
|
RUN cargo test --target aarch64-unknown-linux-gnu --release
|
2022-05-16 11:52:48 -04:00
|
|
|
|
|
|
|
# Package
|
|
|
|
package-linux-amd64:
|
|
|
|
FROM +build-linux-amd64
|
|
|
|
#################################
|
|
|
|
### DEBIAN DPKG .DEB FILES
|
|
|
|
#################################
|
|
|
|
COPY --dir package /veilid
|
|
|
|
# veilid-server
|
|
|
|
RUN /veilid/package/debian/earthly_make_veilid_server_deb.sh amd64 x86_64-unknown-linux-gnu
|
|
|
|
SAVE ARTIFACT --keep-ts /dpkg/out/*.deb AS LOCAL ./target/packages/
|
|
|
|
# veilid-cli
|
|
|
|
RUN /veilid/package/debian/earthly_make_veilid_cli_deb.sh amd64 x86_64-unknown-linux-gnu
|
|
|
|
# save artifacts
|
|
|
|
SAVE ARTIFACT --keep-ts /dpkg/out/*.deb AS LOCAL ./target/packages/
|
|
|
|
|
|
|
|
package-linux-arm64:
|
|
|
|
FROM +build-linux-arm64
|
|
|
|
#################################
|
|
|
|
### DEBIAN DPKG .DEB FILES
|
|
|
|
#################################
|
|
|
|
COPY --dir package /veilid
|
|
|
|
# veilid-server
|
|
|
|
RUN /veilid/package/debian/earthly_make_veilid_server_deb.sh arm64 aarch64-unknown-linux-gnu
|
|
|
|
SAVE ARTIFACT --keep-ts /dpkg/out/*.deb AS LOCAL ./target/packages/
|
|
|
|
# veilid-cli
|
|
|
|
RUN /veilid/package/debian/earthly_make_veilid_cli_deb.sh arm64 aarch64-unknown-linux-gnu
|
|
|
|
# save artifacts
|
|
|
|
SAVE ARTIFACT --keep-ts /dpkg/out/*.deb AS LOCAL ./target/packages/
|
|
|
|
|
|
|
|
package-linux:
|
|
|
|
BUILD +package-linux-amd64
|
|
|
|
BUILD +package-linux-arm64
|