Skip to content

Instantly share code, notes, and snippets.

@Tsugami
Created July 7, 2022 05:59
Show Gist options
  • Save Tsugami/dae286b4391cb83bae45682449d28e3f to your computer and use it in GitHub Desktop.
Save Tsugami/dae286b4391cb83bae45682449d28e3f to your computer and use it in GitHub Desktop.
FROM rust:slim-buster as builder
WORKDIR /code
RUN rustup target add x86_64-unknown-linux-musl
RUN apt update && apt install -y musl-tools musl-dev
RUN update-ca-certificates
RUN user=root cargo init
COPY Cargo.toml Cargo.toml
RUN cargo fetch
COPY src src
RUN cargo build --target x86_64-unknown-linux-musl --release
FROM scratch
WORKDIR /app
COPY --from=builder /code/target/x86_64-unknown-linux-musl/release/mirim mirim
USER 666
EXPOSE 8080
CMD ["/app/mirim"]
FROM rust:1.62 as builder
WORKDIR /app
COPY . .
RUN cargo build --release
FROM debian:bullseye-slim as runtime
COPY --from=builder /app/target/release/mirim /mirim
ENTRYPOINT ["/mirim"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment