docker-debian-repository/Dockerfile
2021-08-31 22:21:11 +08:00

60 lines
1.8 KiB
Docker

FROM debian:latest
LABEL maintainer="Glenn Y. Rolland <glenux@glenux.net>"
LABEL contributors="Dmitrii Zolotov <dzolotov@herzen.spb.ru>"
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update
# Install supervisor for managing services
RUN apt-get install -q -y supervisor cron openssh-server pwgen reprepro screen vim-tiny nginx
# Configure cron
# Install cron for managing regular tasks
RUN sed -i 's/\(session *required *pam_loginuid.so\)/#\1/' /etc/pam.d/cron
# Install ssh (run/stop to create required directories)
RUN mkdir /var/run/sshd
#RUN service ssh start ; sleep 1
RUN service ssh stop
# Configure reprepro
ADD scripts/reprepro-import.sh /usr/local/sbin/reprepro-import
RUN chmod 755 /usr/local/sbin/reprepro-import
RUN mkdir -p /var/lib/reprepro/conf
ADD configs/reprepro-distributions /var/lib/reprepro/conf/distributions
# reprepro config generator
ADD scripts/create-distros.sh /usr/local/sbin/create-distros
RUN chmod 755 /usr/local/sbin/create-distros
ADD configs/reprepro-distributions.temp /etc/reprepro-distributions.temp
# Configure nginx
RUN echo "daemon off;" >> /etc/nginx/nginx.conf
RUN rm -f /etc/nginx/sites-enabled/default
ADD configs/nginx-default.conf /etc/nginx/sites-enabled/default
# Setup root access
RUN echo "root:docker" | chpasswd
# Configure supervisor
RUN service supervisor stop
ADD configs/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
ADD configs/supervisor-cron.conf /etc/supervisor/conf.d/cron.conf
ADD configs/supervisor-ssh.conf /etc/supervisor/conf.d/ssh.conf
ADD configs/supervisor-nginx.conf /etc/supervisor/conf.d/nginx.conf
# Finalize
ENV DEBIAN_FRONTEND newt
ADD scripts/start.sh /usr/local/sbin/start
RUN chmod 755 /usr/local/sbin/start
VOLUME ["/docker/keys", "/docker/incoming", "/repository"]
EXPOSE 80
EXPOSE 22
CMD ["/usr/local/sbin/start"]