|
| 1 | +FROM centos:7 |
| 2 | + |
| 3 | +LABEL maintainer=" [email protected]" |
| 4 | + |
| 5 | +ARG FLEDGE_BRANCH=develop |
| 6 | +ENV FLEDGE_BRANCH ${FLEDGE_BRANCH} |
| 7 | +RUN yum update -y |
| 8 | +RUN yum install -y git rsyslog sudo wget initscripts openssl nginx \ |
| 9 | +centos-release-scl-rh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm |
| 10 | + |
| 11 | +# Fake service control as docker container doesn't use it |
| 12 | +RUN printf '#!/bin/bash \nexit 0' > /usr/bin/systemctl |
| 13 | +RUN chmod 755 /usr/bin/systemctl |
| 14 | + |
| 15 | +WORKDIR /fledge-core |
| 16 | + |
| 17 | +RUN git clone -b $FLEDGE_BRANCH https://github.com/fledge-iot/fledge.git |
| 18 | + |
| 19 | +RUN cd fledge && \ |
| 20 | + chmod +x requirements.sh && \ |
| 21 | + ./requirements.sh && \ |
| 22 | + make install |
| 23 | + |
| 24 | +ENV FLEDGE_ROOT=/usr/local/fledge |
| 25 | + |
| 26 | +VOLUME /usr/local/fledge/data |
| 27 | + |
| 28 | +# These Volumes will be used in future when we want to install plugins |
| 29 | +VOLUME /usr/local/fledge |
| 30 | +VOLUME /fledge-core/fledge |
| 31 | + |
| 32 | +EXPOSE 8081 1995 80 |
| 33 | + |
| 34 | +# Install Fledge repo within container |
| 35 | +RUN echo -e "[fledge]\n\ |
| 36 | +name=fledge Repository\n\ |
| 37 | +baseurl=http://archives.fledge-iot.org/nightly/centos7/x86_64/\n\ |
| 38 | +enabled=1\n\ |
| 39 | +gpgkey=http://archives.fledge-iot.org/RPM-GPG-KEY-fledge\n\ |
| 40 | +gpgcheck=1" > /etc/yum.repos.d/fledge.repo |
| 41 | +RUN yum update -y |
| 42 | + |
| 43 | +# Fix and install fledge-gui |
| 44 | +# With fledge-gui PR https://github.com/fledge-iot/fledge-gui/pull/105, |
| 45 | +# below fix will not be required, next to the 1.9.1 releases. |
| 46 | +RUN rm -f /usr/share/nginx/html/index.html && \ |
| 47 | +yum install -y fledge-gui |
| 48 | + |
| 49 | + |
| 50 | +RUN echo "service rsyslog start" > start.sh && \ |
| 51 | + echo "nginx" > start.sh && \ |
| 52 | + echo "/usr/local/fledge/bin/fledge start" >> start.sh && \ |
| 53 | + echo "tail -f /var/log/messages" >> start.sh && \ |
| 54 | + chmod +x start.sh |
| 55 | + |
| 56 | +CMD ["bash", "/fledge-core/start.sh"] |
0 commit comments