Skip to content

Commit

Permalink
static builds
Browse files Browse the repository at this point in the history
  • Loading branch information
m1guelpf committed Jul 23, 2024
1 parent bca8465 commit 7c86bae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 24 deletions.
15 changes: 3 additions & 12 deletions Dockerfile.cli
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
FROM lukemathwalker/cargo-chef:latest-rust-bookworm AS chef
FROM --platform=linux/amd64 clux/muslrust AS builder
WORKDIR /orbit-cli

FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json --bin orbit-cli

FROM chef AS builder
COPY --from=planner /orbit-cli/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json --bin orbit-cli
COPY . .
RUN cargo build --release --bin orbit-cli

FROM debian:bookworm-slim AS runtime
FROM --platform=linux/amd64 alpine AS runtime
WORKDIR /orbit-cli
RUN apt-get update && apt install -y openssl && rm -rf /var/lib/apt/lists/*
COPY --from=builder /orbit-cli/target/release/orbit-cli /usr/local/bin/orbit
COPY --from=builder /orbit-cli/target/x86_64-unknown-linux-musl/release/orbit-cli /usr/local/bin/orbit

ENTRYPOINT ["/usr/local/bin/orbit"]
15 changes: 3 additions & 12 deletions Dockerfile.server
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
FROM lukemathwalker/cargo-chef:latest-rust-bookworm AS chef
FROM --platform=linux/amd64 clux/muslrust AS builder
WORKDIR /orbit

FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json --bin orbit-server

FROM chef AS builder
COPY --from=planner /orbit/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json --bin orbit-server
COPY . .
RUN cargo build --release --bin orbit-server

FROM debian:bookworm-slim AS runtime
FROM --platform=linux/amd64 alpine AS runtime
WORKDIR /orbit
RUN apt-get update && apt install -y openssl && rm -rf /var/lib/apt/lists/*
COPY --from=builder /orbit/target/release/orbit-server /usr/local/bin
COPY --from=builder /orbit/target/x86_64-unknown-linux-musl/release/orbit-server /usr/local/bin

EXPOSE 8000
ENTRYPOINT ["/usr/local/bin/orbit-server"]
Expand Down

0 comments on commit 7c86bae

Please sign in to comment.