Skip to content

Commit cb40be4

Browse files
authored
Merge pull request #30 from fledge-iot/FOGL-5253.latest
2 parents f05aa53 + 70ce326 commit cb40be4

File tree

4 files changed

+128
-16
lines changed

4 files changed

+128
-16
lines changed

docker/Dockerfile

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,23 @@
11
FROM ubuntu:18.04
22

3-
MAINTAINER Vaibhav Singhal "vaibhav@dianomic.com"
3+
LABEL maintainer="info@dianomic.com"
44

5-
ARG FLEDGE_BRANCH=main
5+
ARG FLEDGE_BRANCH=develop
66
ENV FLEDGE_BRANCH ${FLEDGE_BRANCH}
77
RUN apt-get update && apt-get -y upgrade
8-
RUN apt-get install -y git rsyslog
8+
RUN apt-get install -y git rsyslog sudo wget
9+
# TODO: https://scaledb.atlassian.net/browse/FOGL-4809
10+
# RUN apt-get install -y sqlite3
911

1012
WORKDIR /fledge-core
1113

12-
RUN git clone --single-branch -b $FLEDGE_BRANCH https://github.com/fledge-iot/fledge.git
14+
RUN git clone -b $FLEDGE_BRANCH https://github.com/fledge-iot/fledge.git
1315

1416
RUN cd fledge && \
1517
chmod +x requirements.sh && \
1618
./requirements.sh && \
1719
make install
1820

19-
RUN echo "service rsyslog start" > start.sh && \
20-
echo "/usr/local/fledge/bin/fledge start" >> start.sh && \
21-
echo "tail -f /dev/null" >> start.sh && \
22-
chmod +x start.sh
23-
24-
2521
ENV FLEDGE_ROOT=/usr/local/fledge
2622

2723
VOLUME /usr/local/fledge/data
@@ -30,7 +26,23 @@ VOLUME /usr/local/fledge/data
3026
VOLUME /usr/local/fledge
3127
VOLUME /fledge-core/fledge
3228

33-
EXPOSE 8081 1995
29+
EXPOSE 8081 1995 80
3430

35-
CMD ["bash", "/fledge-core/start.sh"]
3631

32+
RUN wget -q -O - http://archives.fledge-iot.org/KEY.gpg | sudo apt-key add -
33+
RUN echo "deb http://archives.fledge-iot.org/nightly/ubuntu1804/x86_64/ / " > /etc/apt/sources.list.d/fledge.list
34+
RUN apt-get update
35+
36+
RUN sudo apt-get install -y nginx-light
37+
RUN apt-get download fledge-gui && \
38+
dpkg --unpack fledge-gui*.deb && \
39+
sed -i 's/grep/echo/g' /var/lib/dpkg/info/fledge-gui.postinst && \
40+
dpkg --configure fledge-gui
41+
42+
RUN echo "service rsyslog start" > start.sh && \
43+
echo "service nginx start" > start.sh && \
44+
echo "/usr/local/fledge/bin/fledge start" >> start.sh && \
45+
echo "tail -f /dev/null" >> start.sh && \
46+
chmod +x start.sh
47+
48+
CMD ["bash", "/fledge-core/start.sh"]

docker/README.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Installation
22

3-
### Mac & Windows
3+
### macOS & Windows
44

55
Install Docker CE for Mac and Windows (http://docker.com)
66

@@ -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 --build-arg FLEDGE_BRANCH=develop .
25+
$ docker build --tag fledge:dev --build-arg FLEDGE_BRANCH=develop .
2626
```
2727

2828
where name of the image is fledge, FLEDGE_BRANCH is the branch to build (develop, main, 1.5.2 ,etc)
@@ -31,7 +31,7 @@ where name of the image is fledge, FLEDGE_BRANCH is the branch to build (develop
3131

3232

3333
```
34-
$ docker run -d -v /fledge-data:/usr/local/fledge/data --name fledge -p 8081:8081 -p 1995:1995 fledge
34+
$ docker run -d -v ~/fledge-data:/usr/local/fledge/data --name fledge -p 8081:8081 -p 1995:1995 -p 8082:80 fledge:dev
3535
```
3636

3737
-d : run fledge container in detached mode
@@ -42,10 +42,22 @@ where name of the image is fledge, FLEDGE_BRANCH is the branch to build (develop
4242

4343
> To attach to a running conatiner: `docker exec -it fledge bash`
4444
45+
`--network host` mode makes the container use the host's network stack.
4546

4647
### Stopping docker container
4748
```
4849
$ docker stop fledge
4950
```
5051

51-
> Note: The files in fledge-data directory are created by container which creates/runs them as root user. In order to read the fledge.db, you need to change the permission of fledge.db* files, sudo chmod 666 fledge.db*
52+
> Note: The files in fledge-data directory are created by container which creates/runs them as root user. In order to read the fledge.db, you need to change the permission of fledge.db* files, sudo chmod 666 fledge.db*
53+
54+
### notes...
55+
56+
docker save -o fledge-dev.tar fledge:dev
57+
58+
59+
docker load < fledge-dev.tar.gz
60+
docker load --input fledge-dev.tar.gz
61+
62+
docker run -d -v ~/fledge-data:/usr/local/fledge/data --name fledge -p 8081:8081 -p 1995:1995 -p 8082:80 fledge:dev
63+
docker run -d --name fledge -p 8081:8081 -p 1995:1995 -p 8082:80 fledge:dev

docker/latest/Dockerfile

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
FROM ubuntu:18.04
2+
3+
LABEL maintainer="[email protected]"
4+
5+
ENV ARCHITECTURE="x86_64"
6+
ENV OS="ubuntu1804"
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"]

docker/latest/README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
### Build fledge image
2+
3+
```
4+
$ docker build --no-cache --tag fledge:latest .
5+
```
6+
7+
Default will be built with latest stable relase.
8+
9+
```
10+
$ docker build --tag fledge:nightly --build-arg PKG_VERSION=nightly .
11+
```
12+
13+
14+
name of the image is fledge and tag nightly, PKG_VERSION is the version of packages (latest, nightly etc.)
15+
16+
17+
### Run container
18+
19+
20+
```
21+
$ docker run -d -v ~/fledge-data:/usr/local/fledge/data --name fledge -p 8081:8081 -p 1995:1995 -p 8082:80 fledge:latest
22+
```
23+
24+
-d : run fledge container in detached mode
25+
-v : maps host volume /fledge-data to container volume /usr/local/fledge/data
26+
--name : name of the container (fledge)
27+
-p : map the port of host machine (8081) and container (:8081)
28+
fledge : name of the image created in earlier step, with tag latest
29+
30+
> To attach to a running conatiner: `docker exec -it fledge bash`
31+
32+
`--network host` mode makes the container use the host's network stack.
33+
34+
# Tag and push to registry
35+
36+
$ sudo docker tag fledge:latest 100.25.163.15:5000/fledge:latest
37+
38+
$ sudo docker push 100.25.163.15:5000/fledge:latest

0 commit comments

Comments
 (0)