2024-01-09 22:01:54 +01:00
|
|
|
FROM alpine as builder
|
|
|
|
|
|
|
|
RUN apk update && apk add --no-cache git openssl openssl-dev make lua5.1 lua-dev pcre2 pcre2-dev alpine-sdk
|
|
|
|
|
|
|
|
WORKDIR /src
|
|
|
|
|
|
|
|
RUN git clone https://github.com/lefcha/imapfilter.git
|
|
|
|
|
|
|
|
RUN cd imapfilter; make all
|
|
|
|
|
|
|
|
FROM alpine
|
|
|
|
#
|
|
|
|
|
|
|
|
# Ensure we have imapfilter dependencies
|
|
|
|
RUN apk update && apk add --no-cache tini bash ca-certificates openssl lua5.1 pcre2
|
|
|
|
|
|
|
|
RUN mkdir -p /usr/local/share/imapfilter
|
|
|
|
|
|
|
|
COPY --from=builder /src/imapfilter/src/imapfilter /usr/local/bin/
|
|
|
|
COPY --from=builder /src/imapfilter/src/*.lua /usr/local/share/imapfilter/
|
2024-01-10 20:46:12 +01:00
|
|
|
|
|
|
|
# ensure every user can run imapfilter
|
|
|
|
RUN chmod a+x /usr/local/bin/imapfilter
|
|
|
|
|
2024-01-09 22:01:54 +01:00
|
|
|
ADD scripts/entryPoint.sh /entryPoint.sh
|
|
|
|
|
|
|
|
RUN chmod +x /entryPoint.sh
|
|
|
|
|
2024-01-10 20:46:12 +01:00
|
|
|
# add a user for running imapfilter in the container
|
|
|
|
RUN addgroup imapfilter && adduser -D -G imapfilter imapfilter
|
|
|
|
# ensure a homedirectory for the user exists and has correct access rights
|
|
|
|
RUN mkdir -p /home/imapfilter && chown imapfilter.imapfilter /home/imapfilter
|
|
|
|
|
|
|
|
# run everything as the imapfilter user
|
|
|
|
USER imapfilter
|
|
|
|
|
2024-01-09 22:01:54 +01:00
|
|
|
ENTRYPOINT ["/sbin/tini", "--", "/entryPoint.sh"]
|