2022-07-11 13:36:59 +00:00
|
|
|
FROM debian:bullseye AS lldap
|
|
|
|
ARG DEBIAN_FRONTEND=noninteractive
|
|
|
|
ARG TARGETPLATFORM
|
|
|
|
RUN apt update && apt install -y wget
|
|
|
|
WORKDIR /dim
|
|
|
|
COPY bin/ bin/
|
|
|
|
COPY web/ web/
|
|
|
|
|
|
|
|
RUN mkdir -p target/
|
|
|
|
RUN mkdir -p /lldap/app
|
|
|
|
|
|
|
|
RUN if [ "${TARGETPLATFORM}" = "linux/amd64" ]; then \
|
2023-01-22 10:10:26 +00:00
|
|
|
mv bin/x86_64-unknown-linux-musl-lldap-bin/lldap target/lldap && \
|
|
|
|
mv bin/x86_64-unknown-linux-musl-migration-tool-bin/migration-tool target/migration-tool && \
|
2023-03-20 22:50:23 +00:00
|
|
|
mv bin/x86_64-unknown-linux-musl-lldap_set_password-bin/lldap_set_password target/lldap_set_password && \
|
2022-07-11 13:36:59 +00:00
|
|
|
chmod +x target/lldap && \
|
|
|
|
chmod +x target/migration-tool && \
|
2023-03-20 22:50:23 +00:00
|
|
|
chmod +x target/lldap_set_password && \
|
2022-07-11 13:36:59 +00:00
|
|
|
ls -la target/ . && \
|
|
|
|
pwd \
|
|
|
|
; fi
|
2022-10-12 13:16:32 +00:00
|
|
|
|
2022-07-11 13:36:59 +00:00
|
|
|
RUN if [ "${TARGETPLATFORM}" = "linux/arm64" ]; then \
|
2023-01-22 10:10:26 +00:00
|
|
|
mv bin/aarch64-unknown-linux-musl-lldap-bin/lldap target/lldap && \
|
|
|
|
mv bin/aarch64-unknown-linux-musl-migration-tool-bin/migration-tool target/migration-tool && \
|
2023-03-20 22:50:23 +00:00
|
|
|
mv bin/aarch64-unknown-linux-musl-lldap_set_password-bin/lldap_set_password target/lldap_set_password && \
|
2022-07-11 13:36:59 +00:00
|
|
|
chmod +x target/lldap && \
|
|
|
|
chmod +x target/migration-tool && \
|
2023-03-20 22:50:23 +00:00
|
|
|
chmod +x target/lldap_set_password && \
|
2022-07-11 13:36:59 +00:00
|
|
|
ls -la target/ . && \
|
|
|
|
pwd \
|
|
|
|
; fi
|
2022-10-12 13:16:32 +00:00
|
|
|
|
2022-07-11 13:36:59 +00:00
|
|
|
RUN if [ "${TARGETPLATFORM}" = "linux/arm/v7" ]; then \
|
2023-01-22 10:10:26 +00:00
|
|
|
mv bin/armv7-unknown-linux-gnueabihf-lldap-bin/lldap target/lldap && \
|
|
|
|
mv bin/armv7-unknown-linux-gnueabihf-migration-tool-bin/migration-tool target/migration-tool && \
|
2023-03-20 22:50:23 +00:00
|
|
|
mv bin/armv7-unknown-linux-gnueabihf-lldap_set_password-bin/lldap_set_password target/lldap_set_password && \
|
2022-07-11 13:36:59 +00:00
|
|
|
chmod +x target/lldap && \
|
|
|
|
chmod +x target/migration-tool && \
|
2023-03-20 22:50:23 +00:00
|
|
|
chmod +x target/lldap_set_password && \
|
2022-07-11 13:36:59 +00:00
|
|
|
ls -la target/ . && \
|
|
|
|
pwd \
|
|
|
|
; fi
|
|
|
|
|
|
|
|
# Web and App dir
|
|
|
|
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
|
|
|
COPY lldap_config.docker_template.toml /lldap/
|
2022-10-07 17:22:20 +00:00
|
|
|
COPY web/index_local.html web/index.html
|
2022-07-11 13:36:59 +00:00
|
|
|
RUN cp target/lldap /lldap/ && \
|
|
|
|
cp target/migration-tool /lldap/ && \
|
2023-03-20 22:50:23 +00:00
|
|
|
cp target/lldap_set_password /lldap/ && \
|
2022-07-11 13:36:59 +00:00
|
|
|
cp -R web/index.html \
|
|
|
|
web/pkg \
|
|
|
|
web/static \
|
|
|
|
/lldap/app/
|
|
|
|
|
2022-10-07 17:22:20 +00:00
|
|
|
WORKDIR /lldap
|
2022-07-11 13:36:59 +00:00
|
|
|
RUN set -x \
|
|
|
|
&& for file in $(cat /lldap/app/static/libraries.txt); do wget -P app/static "$file"; done \
|
|
|
|
&& for file in $(cat /lldap/app/static/fonts/fonts.txt); do wget -P app/static/fonts "$file"; done \
|
|
|
|
&& chmod a+r -R .
|
2022-10-12 13:16:32 +00:00
|
|
|
|
2022-07-11 13:36:59 +00:00
|
|
|
FROM alpine:3.16
|
|
|
|
WORKDIR /app
|
|
|
|
ENV UID=1000
|
|
|
|
ENV GID=1000
|
|
|
|
ENV USER=lldap
|
2022-07-18 03:52:02 +00:00
|
|
|
ENV GOSU_VERSION 1.14
|
|
|
|
# Fetch gosu from git
|
|
|
|
RUN set -eux; \
|
|
|
|
\
|
|
|
|
apk add --no-cache --virtual .gosu-deps \
|
|
|
|
ca-certificates \
|
|
|
|
dpkg \
|
|
|
|
gnupg \
|
|
|
|
; \
|
|
|
|
\
|
|
|
|
dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \
|
|
|
|
wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \
|
|
|
|
wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \
|
|
|
|
\
|
|
|
|
# verify the signature
|
|
|
|
export GNUPGHOME="$(mktemp -d)"; \
|
|
|
|
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \
|
|
|
|
gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \
|
|
|
|
command -v gpgconf && gpgconf --kill all || :; \
|
|
|
|
rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \
|
|
|
|
\
|
|
|
|
# clean up fetch dependencies
|
|
|
|
apk del --no-network .gosu-deps; \
|
|
|
|
\
|
|
|
|
chmod +x /usr/local/bin/gosu; \
|
|
|
|
# verify that the binary works
|
|
|
|
gosu --version; \
|
|
|
|
gosu nobody true
|
2022-11-01 11:57:49 +00:00
|
|
|
RUN apk add --no-cache tini ca-certificates bash tzdata && \
|
2022-07-11 13:36:59 +00:00
|
|
|
addgroup -g $GID $USER && \
|
|
|
|
adduser \
|
|
|
|
--disabled-password \
|
|
|
|
--gecos "" \
|
|
|
|
--home "$(pwd)" \
|
|
|
|
--ingroup "$USER" \
|
|
|
|
--no-create-home \
|
|
|
|
--uid "$UID" \
|
2022-07-13 06:09:36 +00:00
|
|
|
"$USER" && \
|
|
|
|
mkdir -p /data && \
|
|
|
|
chown $USER:$USER /data
|
2023-03-17 15:23:53 +00:00
|
|
|
COPY --from=lldap --chown=$USER:$USER /lldap /app
|
|
|
|
COPY --from=lldap --chown=$USER:$USER /docker-entrypoint.sh /docker-entrypoint.sh
|
2022-07-13 06:09:36 +00:00
|
|
|
VOLUME ["/data"]
|
2022-07-11 13:36:59 +00:00
|
|
|
WORKDIR /app
|
|
|
|
ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]
|
|
|
|
CMD ["run", "--config-file", "/data/lldap_config.toml"]
|
2023-02-15 08:51:47 +00:00
|
|
|
HEALTHCHECK CMD ["/app/lldap", "healthcheck", "--config-file", "/data/lldap_config.toml"]
|