WIP: Switch to rust 1.70

Alpine image is broken here and this is untested
This commit is contained in:
ViViDboarder 2023-10-17 14:12:47 -07:00
parent e80dce8042
commit 783d9e403e
6 changed files with 449 additions and 230 deletions

622
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -5,10 +5,10 @@ authors = ["ViViDboarder <vividboarder@gmail.com>"]
edition = "2018"
[dependencies]
ldap3 = "0.11"
ldap3 = { version = "0.11", features = ["rustls"] }
serde = { version = "1.0", features = ["derive"] }
toml = "0.5"
reqwest = { version = "0.11", features = ["json", "blocking"] }
reqwest = { version = "0.11", features = ["json", "blocking", "rustls-tls"] }
serde_json = "1.0"
thiserror = "1.0"
anyhow = "1.0"

View File

@ -1,4 +1,4 @@
ARG BUILD_TAG=1.57.0
ARG BUILD_TAG=1.70
ARG RUN_TAG=$BUILD_TAG
FROM rust:$BUILD_TAG as builder

View File

@ -1,23 +1,30 @@
FROM ekidd/rust-musl-builder:1.57.0 AS builder
ARG BUILD_TAG=1.70
WORKDIR /home/rust/src
# Cache build deps
RUN USER=rust cargo init
COPY --chown=rust:rust Cargo.toml Cargo.lock ./
RUN cargo build --locked --release && \
rm src/*.rs
COPY --chown=rust:rust ./src ./src
RUN USER=rust touch ./src/main.rs
# hadolint ignore=DL3059
RUN cargo build --release
FROM alpine:3
FROM rust:$BUILD_TAG-alpine as builder
# hadolint ignore=DL3018
RUN apk --no-cache add ca-certificates
COPY --from=builder \
/home/rust/src/target/x86_64-unknown-linux-musl/release/vaultwarden_ldap \
/usr/local/bin/
RUN apk add --no-cache pkgconfig g++ openssl-dev
CMD ["/usr/local/bin/vaultwarden_ldap"]
WORKDIR /usr/src/
RUN USER=root cargo new --bin vaultwarden_ldap
WORKDIR /usr/src/vaultwarden_ldap
# Compile dependencies
COPY Cargo.toml Cargo.lock ./
RUN cargo build --locked --release
# Remove bins to make sure we rebuild
# hadolint ignore=DL3059
RUN rm ./target/release/deps/vaultwarden_ldap*
# Copy source and install
COPY src ./src
ENV PKG_CONFIG_ALLOW_CROSS=1
ENV OPENSSL_INCLUDE_DIR="/usr/include/openssl"
RUN cargo install --path .
# FROM alpine:3
# hadolint ignore=DL3018
# RUN apk --no-cache add ca-certificates openssl
# COPY --from=builder /usr/local/cargo/bin/vaultwarden_ldap /usr/local/bin/
CMD ["/usr/local/cargo/bin/vaultwarden_ldap"]
# CMD ["/usr/local/bin/vaultwarden_ldap"]

View File

@ -4,7 +4,7 @@ services:
ldap_sync:
build:
context: .
dockerfile: Dockerfile
dockerfile: Dockerfile.alpine
volumes:
- ./example.config.toml:/config.toml:ro
# ./root.cert:/usr/src/vaultwarden_ldap/root.cert:ro

View File

@ -5,8 +5,6 @@ services:
volumes:
- ./itest/config.toml:/config.toml:ro
vaultwarden:
ldap:
command: ["--copy-service"]
volumes: