PiFrameFleet/Dockerfile

142 lines
4.7 KiB
Docker
Raw Normal View History

2020-08-06 22:22:05 +00:00
FROM ubuntu:latest
# General 'stuff'
VOLUME /opt/pictures
VOLUME /opt/misc
ENV CONFIG_NOTIFY_EMAIL=user@domain.tld
ENV CONFIG_NOTIFY_SMTP_SERVER=mail.domain.tld
ENV CONFIG_NOTIFY_SMTP_USER=user@domain.tld
ENV CONFIG_NOTIFY_SMTP_PASS=apassword
# Ansible related 'stuff'
VOLUME /opt/ansible
# rtty 'stuff'
ENV CONFIG_RTTY_USER=admin
ENV CONFIG_RTTY_PASS=apassword
EXPOSE 5913
VOLUME /opt/rtty
# Monit related 'stuff'
ENV CONFIG_MONIT_USER=admin
ENV CONFIG_MONIT_PASS=apassword
EXPOSE 2812/tcp
EXPOSE 2811/tcp
VOLUME /opt/monit
VOLUME /opt/monit-dashboard
# Wireguard related 'stuff'
EXPOSE 51820/udp
VOLUME /lib/modules
VOLUME /opt/wireguard
# SyncThing related 'stuff'
EXPOSE 8384/tcp
EXPOSE 22000/tcp
VOLUME /opt/syncthing
# FileBrowser related 'stuff'
EXPOSE 9191/tcp
VOLUME /opt/filebrowser
# Munin related 'stuff'
VOLUME /opt/munin
EXPOSE 2813
# Dashboard related 'stuff'
VOLUME /opt/dashboard
EXPOSE 80
EXPOSE 443
# Run s6-overlay as the init so we get services and similar
ENTRYPOINT [ "/init" ]
2020-08-06 22:22:05 +00:00
# Don't bother us for selections during install
ENV DEBIAN_FRONTEND="noninteractive"
# We work off /opt, the *nix way
WORKDIR /opt/
# need to figure out if arm64/arm64 32bit multilib/arm/x86-64
COPY arch_detect.sh /opt/
2020-08-06 22:22:05 +00:00
# Install and base setup all the things
# The shell has to be bash for asdf to work properly - its needed for rtty and rttys
SHELL ["/bin/bash", "-c"]
2020-08-06 22:22:05 +00:00
RUN apt update && apt upgrade -y && \
apt install -y python3 curl jq bash unzip nano git tmux htop iotop nload && \
2020-08-06 22:22:05 +00:00
ARCH=$(/opt/arch_detect.sh); \
echo "**** Detected arch: $ARCH ****" && \
S6_RELEASE=$(curl -sX GET "https://api.github.com/repos/just-containers/s6-overlay/tags" \
| jq -r .[0].name); \
echo "**** s6-overlay release: ${S6_RELEASE} ****" && \
echo "**** Installing s6-overlay ****" && \
curl -L https://github.com/just-containers/s6-overlay/releases/latest/download/s6-overlay-${ARCH}.tar.gz \
-o /opt/s6-overlay.tar.gz && \
tar xzf /opt/s6-overlay.tar.gz -C / --exclude="./bin" && \
tar xzf /opt/s6-overlay.tar.gz -C /usr ./bin && \
echo "**** wireguard ****" && \
apt install -y build-essential ifupdown net-tools iproute2 iptables iputils-ping libc6 libelf-dev pkg-config && \
WIREGUARD_RELEASE=$(curl -sX GET "https://api.github.com/repos/WireGuard/wireguard-tools/tags" \
| jq -r .[0].name); \
git clone https://git.zx2c4.com/wireguard-tools /opt/wireguard-tools && \
cd /opt/wireguard-tools && \
git checkout "${WIREGUARD_RELEASE}" && \
make -C src -j$(nproc) && \
make -C src install && \
cd /opt && \
echo "**** monit related ***" && \
apt install -y monit python3-pip python3-setuptools python3-wheel && \
pip3 install xmltodict requests xlsxwriter web.py && \
echo "**** munin related ****" && \
apt install -y munin lighttpd && \
echo "**** rtty related ****" && \
apt install -y libev4 build-essential cmake libev-dev libssl-dev && \
if [ ! -d "/opt/rtty_build" ] ; then mkdir /opt/rtty_build; fi && \
cd /opt/rtty_build && \
mkdir rtty && \
cd rtty && \
git clone --recursive https://github.com/zhaojh329/rtty.git . && \
mkdir build && cd build && \
cmake .. && make install && \
cd /opt && \
mkdir /opt/rtty_build/rttys && \
cd /opt/rtty_build/rttys && \
git clone https://github.com/zhaojh329/rttys.git . && \
git checkout $(git rev-list --tags --max-count=1) && \
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.8.0-rc1 && \
. $HOME/.asdf/asdf.sh && \
asdf update && \
asdf plugin add golang && \
asdf install golang latest && \
asdf global golang $(asdf latest golang) && \
go get -u github.com/zhaojh329/rttys && \
cp ~/.asdf/installs/golang/$(asdf latest golang)/packages/bin/rttys /usr/local/bin/ && \
cd /opt && \
echo "**** dashboard related ****" && \
apt install -y lighttpd && \
2020-08-06 22:22:05 +00:00
echo "**** syncthing ****" && \
curl -s https://syncthing.net/release-key.txt | apt-key add - && \
echo "deb https://apt.syncthing.net/ syncthing stable" | tee /etc/apt/sources.list.d/syncthing.list && \
apt update && apt install -y syncthing && \
echo "**** rclone ****" && \
curl https://rclone.org/install.sh | bash && \
echo "**** filebrowser ****" && \
curl -fsSL https://filebrowser.org/get.sh | bash && \
echo "**** ansible ****" && \
apt install -y python3-apt sshpass ansible ansible-lint ansible-doc && \
echo "**** misc ****" && \
apt install -y msmtp msmtp-mta ca-certificates && \
2020-08-06 22:22:05 +00:00
echo "**** cleanup ****" && \
rm /opt/arch_detect.sh && \
rm /opt/s6-overlay.tar.gz && \
rm -rf /opt/wireguard-tools && \
rm -rf /opt/rtty_build && \
rm -rf ~/.asdf && \
apt remove --purge -y build-essential cmake pkg-config libelf-dev libev-dev libssl-dev unzip && \
2020-08-06 22:22:05 +00:00
apt autoremove --purge -y && \
rm -rf /var/lib/apt/lists/*
# Copy the s6 related 'stuff' to the container
ADD /root/ /