Merge pull request #1 from flotte-goes-smart/multistage-docker

Dockerfile: multistage docker image
pull/2/head
Trivernis 4 years ago committed by GitHub
commit a0889e2a0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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