Skip to content

Commit

Permalink
Do cook step and both builds with --workspace arg
Browse files Browse the repository at this point in the history
  • Loading branch information
divergentdave committed May 12, 2023
1 parent 119fc79 commit d4377cd
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,22 @@ COPY src /src/src
RUN cargo chef prepare --recipe-path recipe.json

FROM chef as builder
WORKDIR /src
COPY --from=planner /src/recipe.json /src/recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
RUN cargo chef cook --workspace --release --recipe-path recipe.json
COPY Cargo.toml /src/Cargo.toml
COPY Cargo.lock /src/Cargo.lock
COPY build.rs /src/build.rs
COPY migration /src/migration
COPY src /src/src
COPY --from=assets /src/app/build /src/app/build
ARG RUST_FEATURES=default
RUN ASSET_DIR=/src/app/build \
cargo build --profile release -p migration && \
cp /src/target/release/migration /migration
RUN ASSET_DIR=/src/app/build \
cargo build --profile release --features ${RUST_FEATURES} && \
cp /src/target/release/divviup_api_bin /divviup_api_bin
RUN ASSET_DIR=/src/app/build cargo build --workspace --release --features ${RUST_FEATURES}

FROM alpine:3.17.3
FROM alpine:3.17.3 AS final
ARG GIT_REVISION=unknown
LABEL revision ${GIT_REVISION}
EXPOSE 8080
ENV HOST=0.0.0.0
COPY --from=builder /migration /migration
COPY --from=builder /divviup_api_bin /divviup_api_bin
COPY --from=builder /src/target/release/migration /migration
COPY --from=builder /src/target/release/divviup_api_bin /divviup_api_bin
ENTRYPOINT ["/divviup_api_bin"]

0 comments on commit d4377cd

Please sign in to comment.