diff options
author | Ellie Huxtable <e@elm.sh> | 2021-04-20 21:53:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-20 20:53:07 +0000 |
commit | a21737e2b7f8d1e426726bdd7536033f299d476a (patch) | |
tree | e940afdff9c145d25d9a2895fd44a77d70719a2e /Dockerfile | |
parent | 34888827f8a06de835cbe5833a06914f28cce514 (diff) |
Use cargo workspaces (#37)
* Switch to Cargo workspaces
Breaking things into "client", "server" and "common" makes managing the
codebase much easier!
client - anything running on a user's machine for adding history
server - handles storing/syncing history and running a HTTP server
common - request/response API definitions, common utils, etc
* Update dockerfile
Diffstat (limited to 'Dockerfile')
-rw-r--r-- | Dockerfile | 53 |
1 files changed, 22 insertions, 31 deletions
@@ -1,31 +1,22 @@ -FROM rust:1.51-buster as builder - -RUN cargo new --bin atuin -WORKDIR /atuin -COPY ./Cargo.toml ./Cargo.toml -COPY ./Cargo.lock ./Cargo.lock - -RUN cargo build --release - -RUN rm src/*.rs - -ADD . ./ - -RUN rm ./target/release/deps/atuin* -RUN cargo build --release - -FROM debian:buster-slim - -RUN apt-get update \ - && apt-get install -y ca-certificates tzdata libpq-dev \ - && rm -rf /var/lib/apt/lists/* - -EXPOSE 8888 - -ENV TZ=Etc/UTC -ENV RUST_LOG=info -ENV ATUIN_CONFIG=/config/config.toml - -COPY --from=builder /atuin/target/release/atuin ./atuin - -ENTRYPOINT ["./atuin"] +FROM lukemathwalker/cargo-chef as planner +WORKDIR app +COPY . . +RUN cargo chef prepare --recipe-path recipe.json + +FROM lukemathwalker/cargo-chef as cacher +WORKDIR app +COPY --from=planner /app/recipe.json recipe.json +RUN cargo chef cook --release --recipe-path recipe.json + +FROM rust as builder +WORKDIR app +COPY . . +# Copy over the cached dependencies +COPY --from=cacher /app/target target +COPY --from=cacher $CARGO_HOME $CARGO_HOME +RUN cargo build --release --bin atuin + +FROM debian:buster-slim as runtime +WORKDIR app +COPY --from=builder /app/target/release/atuin /usr/local/bin +ENTRYPOINT ["/usr/local/bin/atuin"] |