Skip to content
This repository has been archived by the owner on Feb 19, 2021. It is now read-only.

Commit

Permalink
Merge pull request #1 from tuwiendsg/pull-request-docker-example
Browse files Browse the repository at this point in the history
sensor docker example pull request
  • Loading branch information
linhsolar authored Oct 11, 2016
2 parents 02c5b26 + 2a7d97e commit 6881c3f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
15 changes: 15 additions & 0 deletions java/genericsdsensor/examples/sensors/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from leduchung/ubuntu:14.04-jre8

RUN mkdir -p /tmp/sensor

ADD cloud-connectivity-0.0.1-SNAPSHOT-jar-with-dependencies.jar /tmp/sensor/cloud-connectivity-0.0.1-SNAPSHOT-jar-with-dependencies.jar
ADD sdcommon-0.0.1-SNAPSHOT.jar /tmp/sensor/sdcommon-0.0.1-SNAPSHOT.jar
ADD sdsensor-0.0.1-SNAPSHOT-jar-with-dependencies.jar /tmp/sensor/sdsensor-0.0.1-SNAPSHOT-jar-with-dependencies.jar

ADD data.csv /tmp/sensor/data.csv
ADD mqttcloud.json /tmp/sensor/mqttcloud.json
ADD runsensor.sh /tmp/sensor/runsensor.sh

WORKDIR /tmp/sensor

CMD ["/bin/sh", "./runsensor.sh"]
19 changes: 19 additions & 0 deletions java/genericsdsensor/examples/sensors/docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## Run software-define sensor in docker

To use the Dockerfile, following steps need to be done:

1. Build the sensor source code.
2. Copy the following files into the same folder with the Dockerfile:
1. src/sdsensor/target/sdsensor-0.0.1-SNAPSHOT-jar-with-dependencies.jar
2. src/sdcommon/target/sdcommon-0.0.1-SNAPSHOT.jar
3. src/sdcloudconnectivity/target/cloud-connectivity-0.0.1-SNAPSHOT-jar-with-dependencies.jar
4. src/sdsensor/conf/mqttcloud.json (must be edited to match with your MQTT broker)
5. src/sdsensor/datasample/data.csv (optional: replace with your data file)
3. Run following command:
```
docker build -t yourImageName .
docker run yourImageName
```
4. You can view the data being pushed to the MQTT broker with settings as in mqttcloud.json

Note: The Dockerfile use an Ubuntu image with Java by default to run. If you want to use other images, please make sure java is available.

0 comments on commit 6881c3f

Please sign in to comment.