Updated Dockerfiles

This commit is contained in:
GoliathLabs 2021-12-11 14:10:12 +01:00
parent b145763673
commit f0b0252889
No known key found for this signature in database
GPG Key ID: 37F7BDC266B5BAB8
2 changed files with 9 additions and 4 deletions

View File

@ -1,11 +1,16 @@
FROM rust:1.56.1 as builder
ARG BUILD_TAG=1.57.0
ARG RUN_TAG=slim-buster
FROM rust:${BUILD_TAG}-${RUN_TAG} as builder
WORKDIR /usr/src/
RUN USER=root cargo new --bin vaultwarden_ldap
WORKDIR /usr/src/vaultwarden_ldap
# Copy manifests
COPY ./Cargo.lock ./Cargo.lock
COPY ./Cargo.toml ./Cargo.toml
# Compile dependencies
COPY Cargo.toml Cargo.lock ./
RUN cargo build --locked --release
# Remove bins to make sure we rebuild
@ -15,7 +20,7 @@ RUN rm ./target/release/deps/vaultwarden_ldap*
COPY src ./src
RUN cargo build --release
FROM rust:$RUN_TAG
FROM rust:${BUILD_TAG}-${RUN_TAG}
WORKDIR /app
COPY --from=builder /usr/src/vaultwarden_ldap/target/release/vaultwarden_ldap /usr/local/bin/

View File

@ -13,7 +13,7 @@ RUN USER=rust touch ./src/main.rs
# hadolint ignore=DL3059
RUN cargo build --release
FROM alpine:3
FROM alpine:3.15.0
RUN apk --no-cache add ca-certificates=20191127-r7
COPY --from=builder \
/home/rust/src/target/x86_64-unknown-linux-musl/release/vaultwarden_ldap \