Commit 7eba9dde authored by Jan Koester's avatar Jan Koester
Browse files

test

parent 367bb9f3
Loading
Loading
Loading
Loading
Loading

.dockerignore

0 → 100644
+7 −0
Changes for .dockerignore: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
build/
.git/
*.o
*.so
*.a
Dockerfile
.dockerignore

Dockerfile

0 → 100644
+77 −0
Changes for Dockerfile: 77 added lines, 0 removed lines.
Original line number Diff line number Diff line
# proxyplus container image
#
#   build:    tuxist/fenriros-devel  (every FenrirOS package: clang, cmake, ninja and the
#                                     libnetplus/libhttppp/libconfplus/... -dev packages)
#   runtime:  tuxist/fenriros        (minimal: systempp, fresh, rpm, dnf5)
#
#   docker build -t proxyplus .
#   docker run -d -v proxyplus-etc:/etc/proxyplus -v proxyplus-data:/var/lib/proxyplus \
#       -p 80:80 -p 25:25 -p 587:587 -p 8443:8443 -p 4433:4433 proxyplus
#
# Use --build-arg IMAGE_PREFIX=registry.tuxist.de/tuxist/ (and FENRIROS_TAG) to pull the base
# images from another registry/namespace -- see DOCKER_PREFIX in systempp/build-chroot.sh.

ARG IMAGE_PREFIX=tuxist/
ARG FENRIROS_TAG=latest

FROM ${IMAGE_PREFIX}fenriros-devel:${FENRIROS_TAG} AS build

WORKDIR /src/proxyplus
COPY . .

RUN cmake -S . -B build -G Ninja \
        -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DCMAKE_INSTALL_LIBDIR=lib \
 && cmake --build build --target proxyplus proxyplus-bootstrap example_dnsbl letsencrypt zerossl \
 && DESTDIR=/stage cmake --install build

# fenriros only carries the base system, so copy the shared libraries proxyplus and its
# plugins need (DT_NEEDED, resolved recursively against the build image) into the stage,
# plus the confplus backends, which are dlopen()'d and so never show up as DT_NEEDED.
RUN set -e; \
    find_lib() { for d in /usr/lib /lib /usr/local/lib; do [ -e "$d/$1" ] && { echo "$d/$1"; return 0; }; done; return 1; }; \
    todo=$(find /stage/usr/bin /stage/usr/lib/proxyplus -type f); \
    [ -d /usr/lib/confplus ] && { mkdir -p /stage/usr/lib; cp -a /usr/lib/confplus /stage/usr/lib/; \
                                  todo="$todo $(find /stage/usr/lib/confplus -name '*.so*' -type f)"; }; \
    seen=" "; \
    while [ -n "$todo" ]; do \
        next=""; \
        for f in $todo; do \
            for n in $(readelf -d "$f" 2>/dev/null | sed -n 's/.*(NEEDED).*\[\(.*\)\].*/\1/p'); do \
                case "$seen" in *" $n "*) continue ;; esac; \
                seen="$seen$n "; \
                [ -e "/stage/usr/lib/$n" ] && continue; \
                p=$(find_lib "$n") || { echo "warning: $n (needed by $f) not found" >&2; continue; }; \
                mkdir -p "/stage$(dirname "$p")"; \
                cp -L "$p" "/stage$p"; \
                next="$next /stage$p"; \
            done; \
        done; \
        todo=$next; \
    done

FROM ${IMAGE_PREFIX}fenriros:${FENRIROS_TAG}

# Libraries the base image already ships (libc, libc++, ...) must win over the build image's
# copies of the same files, so only fill in what is missing.
COPY --from=build /stage/ /stage/
RUN set -e; \
    cd /stage; \
    find . ! -type d | while read -r f; do \
        t="/${f#./}"; \
        case "$t" in /usr/lib/*.so*|/lib/*.so*) [ -e "$t" ] && continue ;; esac; \
        mkdir -p "$(dirname "$t")"; \
        cp -a "$f" "$t"; \
    done; \
    cd /; rm -rf /stage; \
    mkdir -p /etc/proxyplus /var/lib/proxyplus /var/log/proxyplus; \
    [ -e /etc/proxyplus/proxyplus.yaml ] || cp /usr/share/proxyplus/examples/proxyplus.yaml /etc/proxyplus/proxyplus.yaml

VOLUME ["/etc/proxyplus", "/var/lib/proxyplus"]

# 80 HTTP (+ACME HTTP-01), 25/587 SMTP, 8443 admin API/UI, 4433 cluster
EXPOSE 80 25 587 8443 4433

ENTRYPOINT ["/usr/bin/proxyplus"]
CMD ["/etc/proxyplus/proxyplus.yaml", "-f", "true"]