-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
27 lines (21 loc) · 886 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
FROM ekidd/rust-musl-builder AS builder
MAINTAINER Magnus Bergmark "[email protected]"
# Create new blank project for our dependencies
RUN USER=root cargo init --bin --name prgnome .
# Install dependencies and delete artifacts from the fake project.
COPY ./Cargo.* ./
RUN cargo build --tests && \
cargo build --release && \
rm -r ./src && \
rm -f ./target/*/deps/prgnome* ./target/*-musl/*/deps/prgnome* && \
rm -rf ./target/*/incremental ./target/*-musl/*/incremental
# Actually build this project, making sure tests pass first
COPY ./src ./src
COPY ./tests ./tests
RUN cargo test && cargo build --release
# Build app image
FROM alpine:latest
MAINTAINER Magnus Bergmark "[email protected]"
RUN apk --no-cache add ca-certificates
COPY --from=builder /home/rust/src/target/x86_64-unknown-linux-musl/release/prgnome /usr/local/bin
CMD /usr/local/bin/prgnome