Dockerfile: multistage docker image

pull/1/head
leonnicolas 4 years ago
parent f2ca8c8ab5
commit 4d7662acd4
No known key found for this signature in database
GPG Key ID: 088D0743E2B65C07

@ -1,7 +1,20 @@
FROM rust:alpine
COPY . .
# Build Stage
FROM rust:alpine AS builder
WORKDIR /usr/src/
RUN apk add --no-cache libgcc musl-dev
RUN cargo install --path .
EXPOSE 8080
EXPOSE 5000
ENTRYPOINT ["/usr/local/cargo/bin/flotte-user-management"]
RUN rustup target add x86_64-unknown-linux-musl
RUN USER=root cargo new flotte-user-management
WORKDIR /usr/src/flotte-user-management
COPY Cargo.toml Cargo.lock ./
COPY msg-rpc ./msg-rpc
RUN cargo build --release
COPY src ./src
RUN cargo install --target x86_64-unknown-linux-musl --path .
# Bundle Stage
FROM scratch
COPY --from=builder /usr/local/cargo/bin/flotte-user-management .
ENTRYPOINT ["./flotte-user-management"]
Loading…
Cancel
Save