FROM debian:stable
CMD [ "/sbin/init" ]
ENTRYPOINT [ "/sbin/init" ]

# set default working directory as root for child images
WORKDIR /root/
ONBUILD WORKDIR /root/

# set bash as the default shell for executing commands 
# inside Containerfiles for child images
ONBUILD SHELL ["/bin/bash", "-c"]

# tell bash to read /etc/environment when being run
# non-interactively for child images
ONBUILD ENV BASH_ENV=/etc/environment

# We can't use timedatectl because systemd isn't available
# during the build process, so we have to set the timezone manually
ENV TZ=US/Eastern
RUN rm /etc/localtime && \
    ln -s /usr/share/zoneinfo/$TZ /etc/localtime && \
    echo $TZ > /etc/timezone

# Install packages
RUN apt update -y && \
    apt upgrade -y && \
    apt install -y init sudo wget nano less man-db unzip rsync procps && \
    apt autoremove -y --purge && \
    apt clean -y

# Set configuration
COPY assets/nanorc /etc/nanorc
COPY assets/bash.bashrc /etc/bash.bashrc

# copy custom scripts
COPY assets/bin/ /usr/local/bin/