2026-01-28 13:42:48 +00:00
|
|
|
|
# ================================
|
|
|
|
|
|
# Compile Stage
|
|
|
|
|
|
# ================================
|
|
|
|
|
|
|
|
|
|
|
|
FROM debian:bookworm-slim AS compile
|
|
|
|
|
|
|
|
|
|
|
|
RUN <<EOF
|
|
|
|
|
|
apt update
|
2026-02-05 14:02:32 +00:00
|
|
|
|
apt install -y clang golang
|
2026-01-28 13:42:48 +00:00
|
|
|
|
apt clean
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
2026-02-05 14:02:32 +00:00
|
|
|
|
# TODO: consider removing if not needed
|
|
|
|
|
|
# COPY target/scripts/build/libpam-pgsql.sh .
|
|
|
|
|
|
# RUN bash libpam-pgsql.sh
|
|
|
|
|
|
|
2026-01-28 13:42:48 +00:00
|
|
|
|
WORKDIR /src/
|
|
|
|
|
|
COPY src .
|
2026-02-05 14:02:32 +00:00
|
|
|
|
|
|
|
|
|
|
# log
|
2026-01-28 13:42:48 +00:00
|
|
|
|
RUN clang -O2 -o /usr/local/bin/log /src/log/log.c
|
|
|
|
|
|
|
2026-02-05 14:02:32 +00:00
|
|
|
|
# accounts
|
|
|
|
|
|
WORKDIR /src/account-manager
|
|
|
|
|
|
RUN go build -o /usr/local/bin/accounts .
|
|
|
|
|
|
|
2026-01-28 13:42:48 +00:00
|
|
|
|
# ================================
|
|
|
|
|
|
# Build Stage
|
|
|
|
|
|
# ================================
|
|
|
|
|
|
|
|
|
|
|
|
FROM debian:bookworm-slim AS build
|
|
|
|
|
|
|
|
|
|
|
|
WORKDIR /
|
|
|
|
|
|
|
|
|
|
|
|
# Install dependencies
|
|
|
|
|
|
COPY target/scripts/build/packages.sh /build/
|
|
|
|
|
|
RUN /bin/bash /build/packages.sh && rm -r /build
|
|
|
|
|
|
|
2026-02-05 14:02:32 +00:00
|
|
|
|
# TODO: consider removing if not needed
|
|
|
|
|
|
# COPY --from=compile /pam-pgsql/.libs/pam_pgsql.so /pam-pgsql/.libs/pam_pgsql.la /usr/local/lib/security/
|
|
|
|
|
|
|
2026-01-28 13:42:48 +00:00
|
|
|
|
# Install compiled binaries
|
2026-02-05 14:02:32 +00:00
|
|
|
|
COPY --from=compile \
|
|
|
|
|
|
/usr/local/bin/log \
|
|
|
|
|
|
/usr/local/bin/accounts \
|
|
|
|
|
|
/usr/local/bin/
|
2026-01-28 13:42:48 +00:00
|
|
|
|
|
|
|
|
|
|
# Install helper scripts
|
|
|
|
|
|
COPY target/scripts/*.sh /usr/local/bin/
|
|
|
|
|
|
RUN chmod +x /usr/local/bin/*
|
|
|
|
|
|
COPY target/scripts/helpers /usr/local/bin/helpers
|
|
|
|
|
|
|
|
|
|
|
|
# Supervisor
|
|
|
|
|
|
COPY target/supervisor/supervisord.conf /etc/supervisor/supervisord.conf
|
|
|
|
|
|
COPY target/supervisor/conf.d/* /etc/supervisor/conf.d/
|
|
|
|
|
|
|
|
|
|
|
|
# Dovecot
|
2026-02-05 14:02:32 +00:00
|
|
|
|
COPY target/dovecot/*.inc target/dovecot/*.conf target/dovecot/*.ext /etc/dovecot/conf.d/
|
|
|
|
|
|
|
|
|
|
|
|
RUN <<EOF
|
|
|
|
|
|
useradd -u 5000 -d /home/jupiter -s /bin/bash -p "$(echo jupiter | openssl passwd -1 -stdin)" jupiter
|
|
|
|
|
|
EOF
|
2026-01-28 13:42:48 +00:00
|
|
|
|
|
|
|
|
|
|
EXPOSE 25/tcp 143/tcp 465/tcp 993/tcp
|
|
|
|
|
|
|
|
|
|
|
|
ENTRYPOINT ["/usr/bin/tini", "--"]
|
|
|
|
|
|
CMD ["supervisord", "-c", "/etc/supervisor/supervisord.conf"]
|