forked from cyberkov/openhab-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
56 lines (47 loc) · 1.88 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# openhab image
FROM multiarch/ubuntu-debootstrap:amd64-wily
#FROM multiarch/ubuntu-debootstrap:armhf-wily # arch=armhf
#FROM multiarch/ubuntu-debootstrap:arm64-wily # arch=arm64
ARG ARCH=amd64
ARG DOWNLOAD_URL="https://openhab.ci.cloudbees.com/job/openHAB-Distribution/lastSuccessfulBuild/artifact/distributions/openhab-online/target/openhab-online-2.0.0-SNAPSHOT.zip"
ENV APPDIR="/openhab" OPENHAB_HTTP_PORT='8080' OPENHAB_HTTPS_PORT='8443' EXTRA_JAVA_OPTS=''
# Install Basepackages
RUN \
apt-get update && \
apt-get install --no-install-recommends -y \
software-properties-common \
sudo \
unzip \
wget \
&& rm -rf /var/lib/apt/lists/*
# 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 --no-install-recommends -y oracle-java8-installer && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /var/cache/oracle-jdk8-installer
ENV JAVA_HOME /usr/lib/jvm/java-8-oracle
# 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
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
# Copy directories for host volumes
RUN cp -a /openhab/userdata /openhab/userdata.dist && \
cp -a /openhab/conf /openhab/conf.dist
COPY files/entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]
RUN chown -R openhab:openhab ${APPDIR}
USER openhab
# Expose volume with configuration and userdata dir
VOLUME ${APPDIR}/conf ${APPDIR}/userdata ${APPDIR}/addons
EXPOSE 8080 8443 5555
CMD server