Skip to content

Commit

Permalink
add files for parameterized matrixbuild
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberkov committed Mar 13, 2016
1 parent 33763d0 commit 2d45e80
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 0 deletions.
35 changes: 35 additions & 0 deletions Dockerfile.arm7hf
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# openhab image for armv7hf
FROM cyberkov/openhab-base:arm7hf

ARG DOWNLOAD_URL="https://openhab.ci.cloudbees.com/job/openHAB-Distribution/lastSuccessfulBuild/artifact/distributions/openhab-offline/target/openhab-offline-2.0.0-SNAPSHOT.zip"
ENV APPDIR="/openhab"
RUN [ "cross-build-start" ]

# 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 ./entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]

RUN chown -R openhab:openhab ${APPDIR}
RUN [ "cross-build-end" ]
USER openhab
# Expose volume with configuration and userdata dir
VOLUME ${APPDIR}/conf ${APPDIR}/userdata
EXPOSE 8080 8443 5555
CMD server
33 changes: 33 additions & 0 deletions Dockerfile.x86
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# openhab image for x86
FROM cyberkov/openhab-base:latest

ARG DOWNLOAD_URL="https://openhab.ci.cloudbees.com/job/openHAB-Distribution/lastSuccessfulBuild/artifact/distributions/openhab-offline/target/openhab-offline-2.0.0-SNAPSHOT.zip"
ENV 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

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 ./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
EXPOSE 8080 8443 5555
CMD server
25 changes: 25 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash -x
set -e

# Initialize empty host volumes
if [ -z "$(ls -A "/openhab/userdata")" ]; then
# Copy userdata dir
echo "No userdata found... initializing."
sudo cp -av /openhab/userdata.dist/. /openhab/userdata/
fi

if [ -z "$(ls -A "/openhab/conf")" ]; then
# Copy userdata dir
echo "No configuration found... initializing."
sudo cp -av /openhab/conf.dist/. /openhab/conf/
fi

# Prettier interface
if [ "$1" = 'server' ] || [ "$1" = 'openhab' ]; then
eval /openhab/start.sh
elif [ "$1" = 'debug' ]; then
eval /openhab/start_debug.sh
else
exec "$@"
fi

0 comments on commit 2d45e80

Please sign in to comment.