2019-04-16 16:57:24 +02:00
|
|
|
FROM ekidd/rust-musl-builder:stable as builder
|
|
|
|
|
|
|
|
# create new cargo project
|
|
|
|
RUN USER=rust cargo init --bin
|
|
|
|
# copy build config
|
|
|
|
COPY ./Cargo.lock ./Cargo.lock
|
|
|
|
COPY ./Cargo.toml ./Cargo.toml
|
|
|
|
# build to cache dependencies
|
|
|
|
RUN cargo build --release
|
2019-04-16 18:02:01 +02:00
|
|
|
# delete build cache to prevent caching issues later on
|
2019-04-16 16:57:24 +02:00
|
|
|
RUN rm -r ./target/x86_64-unknown-linux-musl/release/.fingerprint/hoc-*
|
|
|
|
|
|
|
|
# copy source code
|
2019-04-23 18:21:42 +02:00
|
|
|
COPY ./.git ./.git
|
2019-04-16 20:56:24 +02:00
|
|
|
COPY ./static ./static
|
2019-04-23 18:21:42 +02:00
|
|
|
COPY ./templates ./templates
|
2019-04-16 16:57:24 +02:00
|
|
|
COPY ./src ./src
|
|
|
|
# build source code
|
|
|
|
RUN cargo build --release
|
|
|
|
|
|
|
|
FROM alpine:latest
|
|
|
|
|
2019-04-16 17:52:16 +02:00
|
|
|
RUN apk --no-cache add --update git
|
2019-04-16 16:57:24 +02:00
|
|
|
COPY --from=builder /home/rust/src/target/x86_64-unknown-linux-musl/release/hoc /hoc
|
2019-04-16 18:02:01 +02:00
|
|
|
|
|
|
|
ENTRYPOINT ["/hoc"]
|