-
-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Hannes Schaller <admin@cyberkov.at> (github: cyberkov)
- Loading branch information
Showing
2 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# openhab image for x86 | ||
FROM ubuntu:trusty | ||
|
||
RUN \ | ||
apt-get update && \ | ||
apt-get install -y wget unzip software-properties-common && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Install dockerize | ||
RUN \ | ||
wget -nv https://github.com/jwilder/dockerize/releases/download/v0.2.0/dockerize-linux-amd64-v0.2.0.tar.gz &&\ | ||
tar -C /usr/local/bin -xzvf dockerize-linux-amd64-v0.2.0.tar.gz &&\ | ||
rm dockerize-linux-amd64-v0.2.0.tar.gz | ||
|
||
# Install Oracle Java | ||
RUN \ | ||
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \ | ||
add-apt-repository -y ppa:webupd8team/java && \ | ||
apt-get update && \ | ||
apt-get install -y oracle-java8-installer && \ | ||
rm -rf /var/lib/apt/lists/* && \ | ||
rm -rf /var/cache/oracle-jdk8-installer | ||
|
||
ENV DOWNLOAD_URL="https://openhab.ci.cloudbees.com/job/openHAB-Distribution/lastSuccessfulBuild/artifact/distributions/openhab-online/target/openhab-online-2.0.0-SNAPSHOT.zip" \ | ||
APPDIR="/openhab" | ||
|
||
# Add openhab user | ||
RUN adduser --disabled-password --gecos '' --home ${APPDIR} openhab &&\ | ||
adduser openhab sudo &&\ | ||
adduser openhab dialout &&\ | ||
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/openhab | ||
|
||
USER openhab | ||
|
||
WORKDIR ${APPDIR} | ||
|
||
RUN \ | ||
wget -nv -O /tmp/openhab.zip ${DOWNLOAD_URL} &&\ | ||
unzip -q /tmp/openhab.zip -d ${APPDIR} &&\ | ||
rm /tmp/openhab.zip | ||
|
||
RUN mkdir -p ${APPDIR}/userdata/logs && touch ${APPDIR}/userdata/logs/openhab.log | ||
# Expose volume with configuration and userdata dir | ||
VOLUME ${APPDIR}/conf ${APPDIR}/userdata | ||
EXPOSE 8080 8443 5555 | ||
CMD dockerize -stdout ${APPDIR}/userdata/logs/openhab.log ${APPDIR}/start.sh server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,35 @@ | ||
# openhab-docker | ||
Repository for building docker containers for openHAB | ||
|
||
## Usage | ||
|
||
``` | ||
docker run \ | ||
--name openhab \ | ||
--net=host \ | ||
-v /etc/localtime:/etc/localtime:ro \ | ||
-v /opt/openhab/conf:/openhab/conf \ | ||
-v /opt/openhab/userdata:/openhab/userdata \ | ||
openhab/openhab | ||
``` | ||
|
||
or with docker-compose.yml | ||
``` | ||
openhab: | ||
image: 'openhab/openhab' | ||
net: "host" | ||
volumes: | ||
- '/etc/localtime:/etc/localtime:ro' | ||
- '/opt/openhab/conf:/openhab/conf' | ||
- '/opt/openhab/userdata:/openhab/userdata' | ||
devices: | ||
- '/dev/ttyUSB0' | ||
``` | ||
then start with ```docker-compose up -d``` | ||
|
||
**Parameters** | ||
|
||
* `-p 8080` - the port of the webinterface | ||
* `-v /openhab/conf` - openhab configs | ||
* `-v /openhab/userdata` - openhab userdata directory | ||
* `--device=/dev/ttyUSB0` - attach your devices like RFXCOM or Z-Wave Sticks to the conatiner |