-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# Set the Earthly version to 0.7 | ||
VERSION 0.7 | ||
FROM debian:stable-slim | ||
|
||
rust-toolchain: | ||
FROM rust:1.71-slim-bullseye | ||
RUN rustup component add rustfmt | ||
|
||
# Installs Cargo chef | ||
install-chef: | ||
FROM +rust-toolchain | ||
RUN cargo install --debug cargo-chef | ||
|
||
# Prepares the local cache | ||
prepare-cache: | ||
FROM +install-chef | ||
COPY --dir vitup iapyx valgrind integration-tests registration-service registration-verify-service snapshot-trigger-service signals-handler . | ||
COPY Cargo.lock Cargo.toml . | ||
RUN cargo chef prepare | ||
SAVE ARTIFACT recipe.json | ||
SAVE IMAGE --cache-hint | ||
|
||
# Builds the local cache | ||
build-cache: | ||
FROM +install-chef | ||
COPY +prepare-cache/recipe.json ./ | ||
|
||
# Install build dependencies | ||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends \ | ||
build-essential \ | ||
libssl-dev \ | ||
libpq-dev \ | ||
libsqlite3-dev \ | ||
pkg-config \ | ||
protobuf-compiler | ||
|
||
RUN cargo chef cook --release | ||
SAVE ARTIFACT target | ||
SAVE ARTIFACT $CARGO_HOME cargo_home | ||
SAVE IMAGE --cache-hint | ||
|
||
# This is the default builder that all other builders should inherit from | ||
builder: | ||
FROM +rust-toolchain | ||
|
||
WORKDIR /src | ||
|
||
# Install build dependencies | ||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends \ | ||
build-essential \ | ||
libssl-dev \ | ||
libpq-dev \ | ||
libsqlite3-dev \ | ||
pkg-config \ | ||
protobuf-compiler | ||
COPY --dir vitup iapyx valgrind integration-tests registration-service registration-verify-service snapshot-trigger-service signals-handler . | ||
COPY --dir Cargo.lock Cargo.toml . | ||
COPY +build-cache/cargo_home $CARGO_HOME | ||
COPY +build-cache/target target | ||
SAVE ARTIFACT /src | ||
|
||
build: | ||
FROM +builder | ||
|
||
COPY --dir vitup iapyx valgrind integration-tests registration-service registration-verify-service snapshot-trigger-service signals-handler . | ||
COPY Cargo.toml Cargo.lock ./ | ||
|
||
RUN cargo build --locked --release -p iapyx -p valgrind -p vitup | ||
|
||
SAVE ARTIFACT /src/target/release/iapyx iapyx | ||
SAVE ARTIFACT /src/target/release/iapyx-load iapyx-load | ||
SAVE ARTIFACT /src/target/release/valgrind valgrind | ||
SAVE ARTIFACT /src/target/release/vitup vitup |