2020-06-18 02:30:42 +02:00
|
|
|
ARG BASE_IMAGE=opensuse/tumbleweed:latest
|
2022-05-26 13:13:07 +02:00
|
|
|
FROM ${BASE_IMAGE} AS repos
|
|
|
|
RUN zypper refresh --force
|
|
|
|
RUN zypper dup -y
|
|
|
|
|
2022-08-02 08:11:42 +02:00
|
|
|
# ======================
|
2022-05-26 13:13:07 +02:00
|
|
|
FROM repos AS builder
|
2020-04-10 07:50:45 +02:00
|
|
|
|
2022-05-08 05:00:34 +02:00
|
|
|
RUN zypper install -y \
|
2022-09-28 02:31:19 +02:00
|
|
|
rustup \
|
|
|
|
wasm-pack \
|
2022-06-20 03:37:39 +02:00
|
|
|
clang lld \
|
2020-07-28 08:55:58 +02:00
|
|
|
make automake autoconf \
|
2021-01-10 04:41:56 +01:00
|
|
|
libopenssl-devel pam-devel \
|
2021-03-26 02:22:00 +01:00
|
|
|
sqlite3-devel \
|
2022-07-05 03:39:38 +02:00
|
|
|
gcc \
|
2022-08-01 07:52:01 +02:00
|
|
|
rsync \
|
2022-08-02 08:11:42 +02:00
|
|
|
findutils \
|
2022-08-01 07:52:01 +02:00
|
|
|
which
|
2022-06-20 12:16:55 +02:00
|
|
|
RUN zypper clean -a
|
2022-09-28 02:31:19 +02:00
|
|
|
RUN rustup default stable
|
2020-05-06 09:37:07 +02:00
|
|
|
|
|
|
|
COPY . /usr/src/kanidm
|
2018-12-27 06:22:03 +01:00
|
|
|
|
2021-03-26 02:22:00 +01:00
|
|
|
ARG KANIDM_FEATURES
|
2022-07-06 02:54:44 +02:00
|
|
|
ARG KANIDM_BUILD_PROFILE="container_generic"
|
2022-05-31 06:13:21 +02:00
|
|
|
ARG KANIDM_BUILD_OPTIONS=""
|
2021-01-10 04:41:56 +01:00
|
|
|
|
2022-05-08 05:00:34 +02:00
|
|
|
RUN mkdir /scratch
|
2022-05-26 13:13:07 +02:00
|
|
|
RUN echo $KANIDM_BUILD_PROFILE
|
|
|
|
RUN echo $KANIDM_FEATURES
|
|
|
|
|
|
|
|
ENV CARGO_HOME=/scratch/.cargo
|
2022-06-20 03:37:39 +02:00
|
|
|
|
2022-08-02 08:11:42 +02:00
|
|
|
# ======================
|
|
|
|
|
2023-01-23 11:04:03 +01:00
|
|
|
WORKDIR /usr/src/kanidm/kanidmd_web_ui
|
2022-10-05 01:48:48 +02:00
|
|
|
# # This can't be used in the wasm build for now.
|
|
|
|
# # ENV RUSTFLAGS="-Clinker=clang"
|
2023-01-23 11:04:03 +01:00
|
|
|
RUN ./build_wasm.sh
|
2022-08-02 08:11:42 +02:00
|
|
|
|
|
|
|
# ======================
|
2022-06-20 03:37:39 +02:00
|
|
|
|
|
|
|
WORKDIR /usr/src/kanidm/kanidmd/daemon
|
|
|
|
|
2022-08-02 08:11:42 +02:00
|
|
|
# Set the build profile
|
|
|
|
ENV KANIDM_BUILD_PROFILE="${KANIDM_BUILD_PROFILE}"
|
2022-06-20 03:37:39 +02:00
|
|
|
ENV RUSTFLAGS="-Clinker=clang -Clink-arg=-fuse-ld=/usr/bin/ld.lld"
|
2022-05-26 13:13:07 +02:00
|
|
|
|
2022-08-02 08:11:42 +02:00
|
|
|
# Exports don't persist through RUN statements.
|
2023-01-23 11:04:03 +01:00
|
|
|
RUN export CC="/usr/bin/clang"; \
|
2022-08-02 08:11:42 +02:00
|
|
|
if [ -z "${KANIDM_FEATURES}" ]; then \
|
2022-06-20 12:16:55 +02:00
|
|
|
cargo build -p daemon ${KANIDM_BUILD_OPTIONS} \
|
|
|
|
--target-dir="/usr/src/kanidm/target/" \
|
|
|
|
--release; \
|
|
|
|
else \
|
2022-07-06 02:54:44 +02:00
|
|
|
cargo build -p daemon ${KANIDM_BUILD_OPTIONS} \
|
|
|
|
--target-dir="/usr/src/kanidm/target/" \
|
|
|
|
--features="${KANIDM_FEATURES}" \
|
|
|
|
--release; \
|
2023-01-23 11:04:03 +01:00
|
|
|
fi
|
2018-12-27 06:22:03 +01:00
|
|
|
|
2022-05-26 13:13:07 +02:00
|
|
|
RUN ls -al /usr/src/kanidm/target/release
|
|
|
|
|
2022-08-02 08:11:42 +02:00
|
|
|
# ======================
|
|
|
|
|
2022-05-26 13:13:07 +02:00
|
|
|
FROM repos
|
2020-04-11 02:32:56 +02:00
|
|
|
|
2022-05-08 05:00:34 +02:00
|
|
|
RUN zypper install -y \
|
2020-05-06 09:37:07 +02:00
|
|
|
timezone \
|
2020-08-06 08:05:33 +02:00
|
|
|
sqlite3 \
|
2022-05-08 05:00:34 +02:00
|
|
|
pam
|
|
|
|
RUN zypper clean -a
|
2020-04-11 02:32:56 +02:00
|
|
|
|
2020-05-08 02:50:05 +02:00
|
|
|
COPY --from=builder /usr/src/kanidm/target/release/kanidmd /sbin/
|
2021-03-26 02:22:00 +01:00
|
|
|
COPY --from=builder /usr/src/kanidm/kanidmd_web_ui/pkg /pkg
|
2022-07-05 03:39:38 +02:00
|
|
|
RUN chmod +x /sbin/kanidmd
|
2018-12-27 06:22:03 +01:00
|
|
|
|
2020-06-10 04:07:43 +02:00
|
|
|
EXPOSE 8443 3636
|
2020-05-02 12:33:52 +02:00
|
|
|
VOLUME /data
|
2020-05-06 09:37:07 +02:00
|
|
|
|
|
|
|
ENV RUST_BACKTRACE 1
|
2022-07-05 03:39:38 +02:00
|
|
|
CMD [ "/sbin/kanidmd", "server", "-c", "/data/server.toml"]
|