|
| 1 | +FROM ubuntu:20.04 |
| 2 | + |
| 3 | +LABEL maintainer=" [email protected]" |
| 4 | + |
| 5 | +ENV ARCHITECTURE="x86_64" |
| 6 | +ENV OS="ubuntu2004" |
| 7 | + |
| 8 | +ARG PKG_VERSION="latest" |
| 9 | + |
| 10 | +ENV FLEDGE_PKGS_ARCHIVES_LINK="http://archives.fledge-iot.org/${PKG_VERSION}/${OS}/${ARCHITECTURE}/" |
| 11 | + |
| 12 | +# Install pre-requisites |
| 13 | +RUN apt-get update && \ |
| 14 | + apt-get install -y rsyslog curl wget jq nginx-light software-properties-common |
| 15 | + |
| 16 | + |
| 17 | +# Fake service control as docker container doesn't use it |
| 18 | +RUN printf '#!/bin/bash \nexit 0' > /usr/bin/systemctl |
| 19 | +RUN chmod 755 /usr/bin/systemctl |
| 20 | + |
| 21 | +# Install Fledge repo within container |
| 22 | +RUN wget -q -O - http://archives.fledge-iot.org/KEY.gpg | apt-key add - && \ |
| 23 | +add-apt-repository "deb ${FLEDGE_PKGS_ARCHIVES_LINK} / " |
| 24 | + |
| 25 | +# Install fledge |
| 26 | +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y fledge |
| 27 | + |
| 28 | +# Fix and install fledge-gui |
| 29 | +RUN apt-get download fledge-gui && \ |
| 30 | +dpkg --unpack fledge-gui*.deb && \ |
| 31 | +sed -i 's/grep/echo/g' /var/lib/dpkg/info/fledge-gui.postinst && \ |
| 32 | +dpkg --configure fledge-gui |
| 33 | + |
| 34 | +# Build the Start Script |
| 35 | +RUN echo "service rsyslog start" > start.sh && \ |
| 36 | + echo "service nginx start" >> start.sh && \ |
| 37 | + echo "/usr/local/fledge/bin/fledge start" >> start.sh && \ |
| 38 | + echo "tail -f /var/log/syslog" >> start.sh && \ |
| 39 | + chmod +x start.sh |
| 40 | + |
| 41 | +RUN usermod -aG www-data root |
| 42 | + |
| 43 | +ENV FLEDGE_ROOT=/usr/local/fledge |
| 44 | + |
| 45 | +# VOLUME /usr/local/fledge/data |
| 46 | + |
| 47 | +# Fledge API and Fledge GUI ports |
| 48 | +EXPOSE 8081 1995 80 |
| 49 | + |
| 50 | +CMD ["bash", "./start.sh"] |
0 commit comments