2020-09-28 21:58:23 +00:00
|
|
|
FROM ekidd/rust-musl-builder:1.46.0 AS builder
|
2019-04-19 01:13:31 +00:00
|
|
|
|
2020-09-28 21:58:23 +00:00
|
|
|
# Cache build deps
|
2019-04-19 01:13:31 +00:00
|
|
|
RUN USER=rust cargo init
|
2020-09-28 21:58:23 +00:00
|
|
|
COPY Cargo.toml Cargo.lock ./
|
|
|
|
RUN cargo build --locked --release
|
2019-04-19 01:13:31 +00:00
|
|
|
|
|
|
|
# Remove temp src
|
|
|
|
RUN rm src/*.rs
|
2020-09-28 21:58:23 +00:00
|
|
|
# Remove bins to make sure we rebuild
|
|
|
|
# RUN rm ./target/release/deps/bitwarden_rs_ldap*
|
|
|
|
COPY --chown=rust:rust ./src ./src
|
2019-04-19 01:13:31 +00:00
|
|
|
RUN touch ./src/main.rs
|
2020-09-28 21:58:23 +00:00
|
|
|
|
2019-04-19 01:13:31 +00:00
|
|
|
RUN cargo build --release
|
|
|
|
|
2020-07-09 19:04:05 +00:00
|
|
|
FROM alpine:3
|
|
|
|
RUN apk --no-cache add ca-certificates=20191127-r4
|
2019-04-19 01:13:31 +00:00
|
|
|
COPY --from=builder \
|
|
|
|
/home/rust/src/target/x86_64-unknown-linux-musl/release/bitwarden_rs_ldap \
|
|
|
|
/usr/local/bin/
|
|
|
|
|
2020-07-09 19:04:05 +00:00
|
|
|
CMD ["/usr/local/bin/bitwarden_rs_ldap"]
|