Skip to content

Instantly share code, notes, and snippets.

@botdad
Created October 21, 2021 06:12
Show Gist options
  • Save botdad/288563437f063b993c3acded0056f570 to your computer and use it in GitHub Desktop.
Save botdad/288563437f063b993c3acded0056f570 to your computer and use it in GitHub Desktop.
FROM rust as builder
WORKDIR /usr/src/power-clash/
COPY Cargo.toml .
COPY Cargo.lock .
# This is a dummy build to get the dependencies cached.
RUN mkdir src \
&& echo "fn main() {}" > src/main.rs \
&& cargo build --release
COPY . .
RUN touch src/main.rs
# The real build
RUN cargo build --release
FROM rust:slim as runtime
COPY --from=builder /usr/src/power-clash/target/release/power-clash /usr/local/bin/power-clash
ENTRYPOINT ["/usr/local/bin/power-clash"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment