Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(builder): update tracing logs #1252

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix builder docker build
  • Loading branch information
jonaro00 committed Sep 19, 2023
commit 699740552b6e757c4be4b79a754200f1f7ad65bf
39 changes: 21 additions & 18 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ WORKDIR /build


# Stores source cache and cargo chef recipe
FROM cargo-chef as planner
FROM cargo-chef as chef-planner
WORKDIR /src
COPY . .
# Select only the essential files for copying into next steps
Expand All @@ -31,15 +31,15 @@ RUN cargo chef prepare --recipe-path /recipe.json

# Builds crate according to cargo chef recipe.
# This step is skipped if the recipe is unchanged from previous build (no dependencies changed).
FROM cargo-chef AS builder
FROM cargo-chef AS chef-builder
ARG CARGO_PROFILE
COPY --from=planner /recipe.json /
COPY --from=chef-planner /recipe.json /
# https://i.imgflip.com/2/74bvex.jpg
RUN cargo chef cook \
--all-features \
$(if [ "$CARGO_PROFILE" = "release" ]; then echo --release; fi) \
--recipe-path /recipe.json
COPY --from=planner /build .
COPY --from=chef-planner /build .
# Building all at once to share build artifacts in the "cook" layer
RUN cargo build \
$(if [ "$CARGO_PROFILE" = "release" ]; then echo --release; fi) \
Expand Down Expand Up @@ -68,9 +68,17 @@ ENTRYPOINT ["/usr/local/bin/service"]

FROM shuttle-crate-base AS shuttle-auth
ARG CARGO_PROFILE
COPY --from=builder /build/target/${CARGO_PROFILE}/shuttle-auth /usr/local/bin/service
COPY --from=chef-builder /build/target/${CARGO_PROFILE}/shuttle-auth /usr/local/bin/service
FROM shuttle-auth AS shuttle-auth-dev

FROM shuttle-crate-base AS shuttle-builder
ARG CARGO_PROFILE
ARG prepare_args
COPY builder/prepare.sh /prepare.sh
RUN /prepare.sh "${prepare_args}"
COPY --from=chef-builder /build/target/${CARGO_PROFILE}/shuttle-builder /usr/local/bin/service
FROM shuttle-builder AS shuttle-builder-dev

FROM shuttle-crate-base AS shuttle-deployer
ARG CARGO_PROFILE
ARG prepare_args
Expand All @@ -81,38 +89,33 @@ ENV RUSTUP_TOOLCHAIN=${RUSTUP_TOOLCHAIN}
ARG PROD
COPY deployer/prepare.sh /prepare.sh
RUN /prepare.sh "${prepare_args}"
COPY --from=builder /build/target/${CARGO_PROFILE}/shuttle-deployer /usr/local/bin/service
COPY --from=builder /build/target/${CARGO_PROFILE}/shuttle-next /usr/local/cargo/bin/
COPY --from=chef-builder /build/target/${CARGO_PROFILE}/shuttle-deployer /usr/local/bin/service
COPY --from=chef-builder /build/target/${CARGO_PROFILE}/shuttle-next /usr/local/cargo/bin/
FROM shuttle-deployer AS shuttle-deployer-dev
# Source code needed for compiling with [patch.crates-io]
COPY --from=planner /build /usr/src/shuttle/
COPY --from=chef-planner /build /usr/src/shuttle/
FROM shuttle-crate-base AS shuttle-gateway
ARG CARGO_PROFILE
ARG folder
# Some crates need additional libs
COPY ${folder}/*.so /usr/lib/
ENV LD_LIBRARY_PATH=/usr/lib/
COPY --from=builder /build/target/${CARGO_PROFILE}/shuttle-gateway /usr/local/bin/service
COPY --from=chef-builder /build/target/${CARGO_PROFILE}/shuttle-gateway /usr/local/bin/service
FROM shuttle-gateway AS shuttle-gateway-dev
# For testing certificates locally
COPY --from=planner /build/*.pem /usr/src/shuttle/
COPY --from=chef-planner /build/*.pem /usr/src/shuttle/

FROM shuttle-crate-base AS shuttle-logger
ARG CARGO_PROFILE
COPY --from=builder /build/target/${CARGO_PROFILE}/shuttle-logger /usr/local/bin/service
COPY --from=chef-builder /build/target/${CARGO_PROFILE}/shuttle-logger /usr/local/bin/service
FROM shuttle-logger AS shuttle-logger-dev

FROM shuttle-crate-base AS shuttle-provisioner
ARG CARGO_PROFILE
COPY --from=builder /build/target/${CARGO_PROFILE}/shuttle-provisioner /usr/local/bin/service
COPY --from=chef-builder /build/target/${CARGO_PROFILE}/shuttle-provisioner /usr/local/bin/service
FROM shuttle-provisioner AS shuttle-provisioner-dev

FROM shuttle-crate-base AS shuttle-resource-recorder
ARG CARGO_PROFILE
COPY --from=builder /build/target/${CARGO_PROFILE}/shuttle-resource-recorder /usr/local/bin/service
COPY --from=chef-builder /build/target/${CARGO_PROFILE}/shuttle-resource-recorder /usr/local/bin/service
FROM shuttle-resource-recorder AS shuttle-resource-recorder-dev

FROM shuttle-crate-base AS shuttle-builder
ARG CARGO_PROFILE
COPY --from=builder /build/target/${CARGO_PROFILE}/shuttle-builder /usr/local/bin/service
FROM shuttle-builder AS shuttle-builder-dev
2 changes: 1 addition & 1 deletion builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ impl Service {

let mut reader = BufReader::new(stdout).lines();

let id = deployment_id.clone();
tokio::spawn(async move {
let id = deployment_id.clone();
while let Some(line) = reader.next_line().await.expect("to get line") {
info!(deployment_id = %id, "{line}");
}
Expand Down