Browse Source

Adding dockerfile

clement 11 months ago
parent
commit
03e67b1663
2 changed files with 38 additions and 0 deletions
  1. 5 0
      .dockerignore
  2. 33 0
      Dockerfile

+ 5 - 0
.dockerignore

@@ -0,0 +1,5 @@
+target
+Dockerfile
+.dockerignore
+.git
+.gitignore

+ 33 - 0
Dockerfile

@@ -0,0 +1,33 @@
+FROM rust:1.83 AS builder
+
+
+# Caching dependencies
+WORKDIR /bimng
+RUN cargo new --bin bim-ng
+WORKDIR /bimng/bim-ng
+COPY ./Cargo.lock ./Cargo.lock
+COPY ./Cargo.toml ./Cargo.toml
+COPY ./src/ldap ./src/ldap
+RUN cargo build --release
+RUN rm src/*.rs
+
+# Real build
+COPY . .
+RUN rm ./target/release/deps/bim_ng*
+RUN cargo build --release
+
+# Final image
+FROM debian:bookworm-slim
+
+RUN apt-get update && apt-get install -y libssl3 && \
+apt-get install -y ca-certificates
+
+WORKDIR /
+COPY --from=builder /bimng/bim-ng/target/release/bim-ng /bim-ng
+COPY ./templates /templates
+RUN mkdir /etc/bim-ng
+COPY ./src/settings.toml.example /etc/bim-ng/settings.toml
+
+ENV BIMNG_SETTINGS_PATH="/etc/bim-ng/settings.toml"
+
+CMD ["/bim-ng"]