FROM alpine:3.15
COPY etc/apk/repositories /etc/apk/repositories
RUN wget --quiet --output-document=/etc/apk/keys/alpine@sr.ht.rsa.pub https://mirror.sr.ht/alpine/alpine@sr.ht.rsa.pub
RUN apk update
RUN apk add postfix meta.sr.ht git.sr.ht todo.sr.ht supervisor nginx fcgiwrap spawn-fcgi py3-gunicorn
# setup directories
RUN mkdir /etc/postfix/sasl && chmod 700 /etc/postfix/sasl
RUN mkdir /var/log/supervisord
# setup nginx
COPY etc/nginx/nginx.conf /etc/nginx/nginx.conf
COPY etc/nginx/graphql.conf /etc/nginx/graphql.conf
COPY etc/nginx/headers.conf /etc/nginx/headers.conf
COPY etc/nginx/web.conf /etc/nginx/web.conf
COPY etc/nginx/http.d/test.conf /etc/nginx/http.d/test.conf
COPY --chown=nginx:nginx usr/share/nginx/html/index.html /usr/share/nginx/html/index.html
COPY --chown=nginx:nginx usr/share/nginx/html/test.cgi /usr/share/nginx/html/test.cgi
COPY --chown=nginx:nginx usr/share/nginx/html/test.php /usr/share/nginx/html/test.php
COPY etc/nginx/http.d/default.conf /etc/nginx/http.d/default.conf
COPY etc/nginx/http.d/git.conf /etc/nginx/http.d/git.conf
COPY etc/nginx/http.d/lists.conf /etc/nginx/http.d/lists.conf
COPY etc/nginx/http.d/meta.conf /etc/nginx/http.d/meta.conf
COPY etc/nginx/http.d/todo.conf /etc/nginx/http.d/todo.conf
# setup postfix
COPY etc/postfix/main.cf /etc/postfix/main.cf
COPY etc/postfix/master.cf /etc/postfix/master.cf
COPY etc/postfix/transport /etc/postfix/transport
RUN postmap /etc/postfix/transport
COPY etc/postfix/generic /etc/postfix/generic
RUN postmap /etc/postfix/generic
COPY etc/postfix/sasl/sasl_passwd /etc/postfix/sasl/sasl_passwd
RUN postmap /etc/postfix/sasl/sasl_passwd
# setup sourcehut
COPY etc/sr.ht/config.ini /etc/sr.ht/config.ini
COPY etc/sr.ht/pgp.key /etc/sr.ht/pgp.key
COPY etc/sr.ht/pgp.pubkey /etc/sr.ht/pgp.pubkey
# setup supervisor
USER root
EXPOSE 8080
COPY etc/supervisor/conf.d/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
CMD ["/usr/bin/supervisord","-c","/etc/supervisor/conf.d/supervisord.conf"]