rust docker
May 28, 2019
Dockerfile
to create small rust docker images:
FROM clux/muslrust
RUN mkdir /source
WORKDIR /source
COPY . .
RUN cargo build --release
RUN strip ./target/x86_64-unknown-linux-musl/release/myapp
FROM scratch
COPY --from=0 /source/target/x86_64-unknown-linux-musl/release/myapp /
CMD ["./myapp"]
Image compatible with cloud foundry:
FROM rust:1.35
WORKDIR /usr/src/myapp
COPY . .
RUN cargo build --release
FROM debian:latest
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y openssl ca-certificates
COPY --from=0 /usr/src/myapp/target/release/myapp /
CMD ["./myapp"]