Docker build fixes (#904)

* Added KANIDM_BUILD_PROFILE to `kanidmd` build Dockerfile
This commit is contained in:
James Hodgkinson 2022-07-06 10:54:44 +10:00 committed by GitHub
parent fedc21ddca
commit 534bd9f621
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 23 deletions

View file

@ -1,7 +1,7 @@
# This builds the kanidm CLI tool
ARG BASE_IMAGE=opensuse/tumbleweed:latest
FROM ${BASE_IMAGE} AS repos
# To help mirrors not be as bad
RUN zypper install -y mirrorsorcerer
RUN /usr/sbin/mirrorsorcerer -x; true
@ -9,12 +9,14 @@ RUN zypper refresh --force
RUN zypper dup -y
FROM repos AS builder
ARG SCCACHE_REDIS=""
ARG KANIDM_FEATURES
ARG KANIDM_BUILD_PROFILE
ARG KANIDM_BUILD_OPTIONS=""
RUN zypper install -y \
cargo \
gcc \
rust wasm-pack \
clang lld \
cargo rust wasm-pack \
gcc clang lld \
make automake autoconf \
libopenssl-devel \
pam-devel \
@ -26,22 +28,16 @@ RUN zypper clean -a
COPY . /usr/src/kanidm
ARG SCCACHE_REDIS=""
ARG KANIDM_FEATURES
ARG KANIDM_BUILD_PROFILE
ARG KANIDM_BUILD_OPTIONS=""
RUN mkdir /scratch
RUN echo $KANIDM_BUILD_PROFILE
RUN echo $KANIDM_FEATURES
ENV KANIDM_BUILD_PROFILE=${KANIDM_BUILD_PROFILE:-container_generic}
RUN echo Features $KANIDM_FEATURES
ENV CARGO_HOME=/scratch/.cargo
ENV RUSTFLAGS="-Clinker=clang"
WORKDIR /usr/src/kanidm/
ENV RUSTFLAGS="-Clinker=clang -Clink-arg=-fuse-ld=/usr/bin/ld.lld"
# set up sccache if you've done the thing
RUN if [ "${SCCACHE_REDIS}" != "" ]; \
then \
export CARGO_INCREMENTAL=false && \
@ -52,6 +48,7 @@ else \
export CC="/usr/bin/clang"; \
fi
WORKDIR /usr/src/kanidm/
# build the CLI
RUN if [ -z "${KANIDM_FEATURES}" ]; then \
cargo build -p kanidm_tools --bin kanidm ${KANIDM_BUILD_OPTIONS} \
@ -82,5 +79,4 @@ RUN zypper remove -y busybox-adduser
USER kanidm
ENTRYPOINT [ "/sbin/kanidm" ]
CMD [ "/sbin/kanidm", "-c", "/data/kanidm.toml" ]

View file

@ -6,8 +6,8 @@ RUN /usr/sbin/mirrorsorcerer -x; true
RUN zypper refresh --force
RUN zypper dup -y
FROM repos AS builder
LABEL maintainer william@blackhats.net.au
RUN zypper install -y \
cargo \
@ -25,13 +25,16 @@ COPY . /usr/src/kanidm
ARG SCCACHE_REDIS=""
ARG KANIDM_FEATURES
ARG KANIDM_BUILD_PROFILE
ARG KANIDM_BUILD_PROFILE="container_generic"
ARG KANIDM_BUILD_OPTIONS=""
RUN mkdir /scratch
RUN echo $KANIDM_BUILD_PROFILE
RUN echo $KANIDM_FEATURES
# Set the build profile
ENV KANIDM_BUILD_PROFILE="${KANIDM_BUILD_PROFILE}"
ENV CARGO_HOME=/scratch/.cargo
ENV RUSTFLAGS="-Clinker=clang"
@ -63,17 +66,16 @@ RUN if [ -z "${KANIDM_FEATURES}" ]; then \
--target-dir="/usr/src/kanidm/target/" \
--release; \
else \
cargo build -p daemon ${KANIDM_BUILD_OPTIONS} \
--target-dir="/usr/src/kanidm/target/" \
--features="${KANIDM_FEATURES}" \
--release; \
cargo build -p daemon ${KANIDM_BUILD_OPTIONS} \
--target-dir="/usr/src/kanidm/target/" \
--features="${KANIDM_FEATURES}" \
--release; \
fi
RUN if [ "${SCCACHE_REDIS}" != "" ]; then sccache -s; fi
RUN ls -al /usr/src/kanidm/target/release
FROM repos
LABEL maintainer william@blackhats.net.au
RUN zypper install -y \
timezone \