Skip to content

Commit e82ae29

Browse files
Merge pull request #34 from fledge-iot/FOGL-5142.3
Make based Dockerfiles for ubuntu20 and centos7
2 parents 0aa5e83 + 521d8ee commit e82ae29

File tree

4 files changed

+115
-1
lines changed

4 files changed

+115
-1
lines changed

docker/Dockerfile.centos7

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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"]

docker/Dockerfile renamed to docker/Dockerfile.ubuntu1804

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ RUN apt-get install -y git rsyslog sudo wget
99
# TODO: https://scaledb.atlassian.net/browse/FOGL-4809
1010
# RUN apt-get install -y sqlite3
1111

12+
# Fake service control as docker container doesn't use it
13+
RUN printf '#!/bin/bash \nexit 0' > /usr/bin/systemctl
14+
RUN chmod 755 /usr/bin/systemctl
15+
1216
WORKDIR /fledge-core
1317

1418
RUN git clone -b $FLEDGE_BRANCH https://github.com/fledge-iot/fledge.git

docker/Dockerfile.ubuntu2004

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
FROM ubuntu:20.04
2+
3+
LABEL maintainer="[email protected]"
4+
5+
ARG FLEDGE_BRANCH=develop
6+
ENV FLEDGE_BRANCH ${FLEDGE_BRANCH}
7+
RUN apt-get update && apt-get -y upgrade
8+
RUN apt-get install -y git rsyslog sudo wget
9+
# https://serverfault.com/questions/949991/how-to-install-tzdata-on-a-ubuntu-docker-image
10+
RUN DEBIAN_FRONTEND="noninteractive" apt-get -y install tzdata
11+
# TODO: https://scaledb.atlassian.net/browse/FOGL-4809
12+
# RUN apt-get install -y sqlite3
13+
14+
# Fake service control as docker container doesn't use it
15+
RUN printf '#!/bin/bash \nexit 0' > /usr/bin/systemctl
16+
RUN chmod 755 /usr/bin/systemctl
17+
18+
WORKDIR /fledge-core
19+
20+
RUN git clone -b $FLEDGE_BRANCH https://github.com/fledge-iot/fledge.git
21+
22+
RUN cd fledge && \
23+
chmod +x requirements.sh && \
24+
./requirements.sh && \
25+
make install
26+
27+
ENV FLEDGE_ROOT=/usr/local/fledge
28+
29+
VOLUME /usr/local/fledge/data
30+
31+
# These Volumes will be used in future when we want to install plugins
32+
VOLUME /usr/local/fledge
33+
VOLUME /fledge-core/fledge
34+
35+
EXPOSE 8081 1995 80
36+
37+
38+
RUN wget -q -O - http://archives.fledge-iot.org/KEY.gpg | sudo apt-key add -
39+
RUN echo "deb http://archives.fledge-iot.org/nightly/ubuntu2004/x86_64/ / " > /etc/apt/sources.list.d/fledge.list
40+
RUN apt-get update
41+
42+
RUN sudo apt-get install -y nginx-light
43+
RUN apt-get download fledge-gui && \
44+
dpkg --unpack fledge-gui*.deb && \
45+
sed -i 's/grep/echo/g' /var/lib/dpkg/info/fledge-gui.postinst && \
46+
dpkg --configure fledge-gui
47+
48+
RUN echo "service rsyslog start" > start.sh && \
49+
echo "service nginx start" > start.sh && \
50+
echo "/usr/local/fledge/bin/fledge start" >> start.sh && \
51+
echo "tail -f /dev/null" >> start.sh && \
52+
chmod +x start.sh
53+
54+
CMD ["bash", "/fledge-core/start.sh"]

docker/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/
2222
### Build fledge image
2323

2424
```
25-
$ docker build --tag fledge:dev --build-arg FLEDGE_BRANCH=develop .
25+
$ docker build --tag fledge:dev --build-arg FLEDGE_BRANCH=develop -f Dockerfile.ubuntu1804 .
2626
```
2727

2828
where name of the image is fledge, FLEDGE_BRANCH is the branch to build (develop, main, 1.5.2 ,etc)

0 commit comments

Comments
 (0)