Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker image based on Alpine Linux #107

Merged
merged 31 commits into from
Oct 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
174c56b
Add 2.1.0 and 2.2.0-SNAPSHOT Versions
cniweb Jun 28, 2017
bebbeaf
Update README to Version 2.1.0
cniweb Jun 28, 2017
666d9c4
Add Version 2.1.0 and 2.2.0-snapshot
cniweb Jun 28, 2017
ed621b4
Add Version 2.1.0 and 2.2.0-snapshot
cniweb Jun 28, 2017
bddcc10
Update entrypoint.sh (#94) (#1)
cniweb Jun 28, 2017
9c92eed
Merge remote-tracking branch 'refs/remotes/openhab/master'
cniweb Jun 28, 2017
31587c4
Remove Version 2.2.0-snapshot and add 2.1.0-snapshot
cniweb Jun 28, 2017
ffe55d0
Echo actual `NEW_USER_ID`, instead of hardcoded/default id=9001.
cniweb Jun 28, 2017
78c5537
Fix sudo enabled environment for travis
cniweb Jun 28, 2017
c334994
RUN chmod +x on entrypoint.sh within Dockerfile to fix permission issue
cniweb Jun 28, 2017
e5256e6
Merge remote-tracking branch 'refs/remotes/openhab/master'
cniweb Jun 29, 2017
c25de88
Add version 2.2.0-snapshot
cniweb Jun 29, 2017
6449379
Merge remote-tracking branch 'refs/remotes/openhab/master'
cniweb Jun 29, 2017
03ab20c
Add MAINTAINER section
cniweb Jun 29, 2017
4f0c0a3
Merge remote-tracking branch 'refs/remotes/openhab/master'
cniweb Oct 2, 2017
5c825e9
Docker image based on Alpine Linux #99
cniweb Oct 2, 2017
1185640
Docker image based on Alpine Linux #99
cniweb Oct 2, 2017
dd8bf16
Docker image based on Alpine Linux #99
cniweb Oct 2, 2017
d9aa0b1
Docker image based on Alpine Linux #99
cniweb Oct 2, 2017
6312e6e
Docker image based on Alpine Linux #99
cniweb Oct 2, 2017
8af25d6
Docker image based on Alpine Linux #99
cniweb Oct 2, 2017
c22445d
Merge remote-tracking branch 'refs/remotes/openhab/master'
cniweb Oct 2, 2017
71ff016
Docker image based on Alpine Linux #99
cniweb Oct 4, 2017
26f73d2
Openhab GROUP_ID can now be set via variable at container creation time
cniweb Oct 4, 2017
d46bd05
Docker image based on Alpine Linux #99
cniweb Oct 4, 2017
afd3f88
Docker image based on Alpine Linux #99
cniweb Oct 4, 2017
df3a3ff
Docker image based on Alpine Linux #99
cniweb Oct 4, 2017
26b2fd1
Docker image based on Alpine Linux #99
cniweb Oct 5, 2017
41cfe7f
Docker image based on Alpine Linux #99
cniweb Oct 5, 2017
a323f81
Docker image based on Alpine Linux #99
cniweb Oct 5, 2017
cf661df
Docker image based on Alpine Linux #99
cniweb Oct 11, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 27 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ before_install:
- docker info
- docker run --rm --privileged multiarch/qemu-user-static:register --reset
install:
- docker build --build-arg VCS_REF=$TRAVIS_COMMIT --build-arg BUILD_DATE=$(date +"%Y-%m-%dT%H:%M:%SZ") -t $DOCKER_REPO:$VERSION-$TARGET $VERSION/$TARGET
- docker run --rm $DOCKER_REPO:$VERSION-$TARGET uname -a
- docker build --build-arg VCS_REF=$TRAVIS_COMMIT --build-arg BUILD_DATE=$(date +"%Y-%m-%dT%H:%M:%SZ") -t $DOCKER_REPO:$VERSION-$TARGET-$DIST $VERSION/$TARGET/$DIST
- docker run --rm $DOCKER_REPO:$VERSION-$TARGET-$DIST uname -a
after_success:
- docker login -e=$DOCKER_EMAIL -u=$DOCKER_USERNAME -p=$DOCKER_PASSWORD
- docker push $DOCKER_REPO:$VERSION-$TARGET
- docker push $DOCKER_REPO:$VERSION-$TARGET-$DIST
env:
#global:
# - DOCKER_REPO=openhab/openhab
Expand All @@ -23,17 +23,29 @@ env:
# - DOCKER_USERNAME
# - DOCKER_PASSWORD
matrix:
- TARGET=amd64 VERSION=1.8.3
- TARGET=armhf VERSION=1.8.3
- TARGET=arm64 VERSION=1.8.3
- TARGET=amd64 VERSION=2.0.0
- TARGET=armhf VERSION=2.0.0
- TARGET=arm64 VERSION=2.0.0
- TARGET=amd64 VERSION=2.1.0
- TARGET=armhf VERSION=2.1.0
- TARGET=arm64 VERSION=2.1.0
- TARGET=amd64 VERSION=2.2.0-snapshot
- TARGET=armhf VERSION=2.2.0-snapshot
- TARGET=arm64 VERSION=2.2.0-snapshot
- DIST=debian TARGET=amd64 VERSION=1.8.3
- DIST=debian TARGET=armhf VERSION=1.8.3
- DIST=debian TARGET=arm64 VERSION=1.8.3
- DIST=debian TARGET=amd64 VERSION=2.0.0
- DIST=debian TARGET=armhf VERSION=2.0.0
- DIST=debian TARGET=arm64 VERSION=2.0.0
- DIST=debian TARGET=amd64 VERSION=2.1.0
- DIST=debian TARGET=armhf VERSION=2.1.0
- DIST=debian TARGET=arm64 VERSION=2.1.0
- DIST=debian TARGET=amd64 VERSION=2.2.0-snapshot
- DIST=debian TARGET=armhf VERSION=2.2.0-snapshot
- DIST=debian TARGET=arm64 VERSION=2.2.0-snapshot
- DIST=alpine TARGET=amd64 VERSION=1.8.3
- DIST=alpine TARGET=armhf VERSION=1.8.3
- DIST=alpine TARGET=arm64 VERSION=1.8.3
- DIST=alpine TARGET=amd64 VERSION=2.0.0
- DIST=alpine TARGET=armhf VERSION=2.0.0
- DIST=alpine TARGET=arm64 VERSION=2.0.0
- DIST=alpine TARGET=amd64 VERSION=2.1.0
- DIST=alpine TARGET=armhf VERSION=2.1.0
- DIST=alpine TARGET=arm64 VERSION=2.1.0
- DIST=alpine TARGET=amd64 VERSION=2.2.0-snapshot
- DIST=alpine TARGET=armhf VERSION=2.2.0-snapshot
- DIST=alpine TARGET=arm64 VERSION=2.2.0-snapshot
matrix:
fast_finish: true
82 changes: 82 additions & 0 deletions 1.8.3/amd64/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# openhab image
#
# ------------------------------------------------------------------------------
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
#
# PLEASE DO NOT EDIT IT DIRECTLY.
# ------------------------------------------------------------------------------
#

FROM multiarch/alpine:amd64-latest-stable

MAINTAINER openHAB <info@openhabfoundation.org>

# Set download urls
ENV JAVA_URL="https://www.azul.com/downloads/zulu/zdk-8-ga-linux_x64.tar.gz"
ENV OPENHAB_URL="https://bintray.com/artifact/download/openhab/bin/distribution-1.8.3-runtime.zip"
ENV OPENHAB_VERSION="1.8.3"

# Set variables
ENV \
APPDIR="/openhab" \
EXTRA_JAVA_OPTS="" \
OPENHAB_HTTP_PORT="8080" \
OPENHAB_HTTPS_PORT="8443"

# Basic build-time metadata as defined at http://label-schema.org
ARG BUILD_DATE
ARG VCS_REF
LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.docker.dockerfile="/Dockerfile" \
org.label-schema.license="EPL" \
org.label-schema.name="openHAB" \
org.label-schema.url="http://www.openhab.com/" \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-type="Git" \
org.label-schema.vcs-url="https://github.com/openhab/openhab-docker.git" \
maintainer="openHAB <info@openhabfoundation.org>"

# Set locales
ENV \
LC_ALL=en_US.UTF-8 \
LANG=en_US.UTF-8 \
LANGUAGE=en_US.UTF-8

# Install basepackages
RUN apk update && \
apk add \
ca-certificates \
fontconfig \
libpcap-dev \
unzip \
dpkg \
gnupg \
wget \
bash \
shadow

# Install java
RUN apk add openjdk8

# Install su-exec
RUN apk add su-exec

# Install openhab
RUN wget -nv -O /tmp/openhab.zip ${OPENHAB_URL} &&\
unzip -q /tmp/openhab.zip -d ${APPDIR} &&\
rm /tmp/openhab.zip &&\
cp -a ${APPDIR}/configurations ${APPDIR}/configurations.dist && \
echo "export TERM=dumb" | tee -a ~/.bashrc

# Expose volume with configuration and userdata dir
VOLUME ${APPDIR}/configurations ${APPDIR}/addons

# Set working directory, expose and entrypoint
WORKDIR ${APPDIR}
EXPOSE 8080 8443 5555
COPY entrypoint.sh /
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
# Execute command

CMD ["su-exec", "openhab", "./start.sh"]
46 changes: 46 additions & 0 deletions 1.8.3/amd64/alpine/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/sh -x
set -euo pipefail
IFS=$'\n\t'

# Add openhab user & handle possible device groups for different host systems
# Container base image puts dialout on group id 20, uucp on id 10
# GPIO Group for RPI access
NEW_USER_ID=${USER_ID:-9001}
echo "Starting with openhab user id: $NEW_USER_ID"
if ! id -u openhab >/dev/null 2>&1; then
echo "Create user openhab with id 9001"
adduser -u $NEW_USER_ID -D -g '' -h ${APPDIR} openhab
fi

# Copy initial files to host volume
case ${OPENHAB_VERSION} in
1.8.3)
if [ -z "$(ls -A "${APPDIR}/configurations")" ]; then
# Copy userdata dir for version 1.8.3
echo "No configuration found... initializing."
cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/"
fi
;;
2.0.0|2.1.0|2.2.0-snapshot)
# Initialize empty host volumes
if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then
# Copy userdata dir for version 2.0.0
echo "No userdata found... initializing."
cp -av "${APPDIR}/userdata.dist/." "${APPDIR}/userdata/"
fi

if [ -z "$(ls -A "${APPDIR}/conf")" ]; then
# Copy userdata dir for version 2.0.0
echo "No configuration found... initializing."
cp -av "${APPDIR}/conf.dist/." "${APPDIR}/conf/"
fi
;;
*)
echo openHAB version ${OPENHAB_VERSION} not supported!
;;
esac

# Set openhab folder permission
chown -R openhab:openhab ${APPDIR}

exec "$@"
44 changes: 23 additions & 21 deletions 1.8.3/amd64/Dockerfile → 1.8.3/amd64/debian/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ ENV OPENHAB_VERSION="1.8.3"
# Set variables
ENV \
APPDIR="/openhab" \
DEBIAN_FRONTEND=noninteractive \
EXTRA_JAVA_OPTS="" \
JAVA_HOME='/usr/lib/java-8' \
OPENHAB_HTTP_PORT="8080" \
OPENHAB_HTTPS_PORT="8443"

Expand All @@ -35,28 +33,31 @@ LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.url="http://www.openhab.com/" \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-type="Git" \
org.label-schema.vcs-url="https://github.com/openhab/openhab-docker.git"

# Install basepackages
RUN apt-get update && \
apt-get install --no-install-recommends -y \
ca-certificates \
fontconfig \
locales \
locales-all \
libpcap-dev \
netbase \
unzip \
wget \
&& rm -rf /var/lib/apt/lists/*
org.label-schema.vcs-url="https://github.com/openhab/openhab-docker.git" \
maintainer="openHAB <info@openhabfoundation.org>"

# Set locales
ENV \
LC_ALL=en_US.UTF-8 \
LANG=en_US.UTF-8 \
LANGUAGE=en_US.UTF-8

# Install basepackages
RUN apt-get update && \
apt-get install --no-install-recommends -y \
ca-certificates \
fontconfig \
locales \
locales-all \
libpcap-dev \
netbase \
unzip \
wget \
&& rm -rf /var/lib/apt/lists/*
ENV DEBIAN_FRONTEND=noninteractive

# Install java
ENV JAVA_HOME='/usr/lib/java-8'
RUN wget -nv -O /tmp/java.tar.gz ${JAVA_URL} &&\
mkdir ${JAVA_HOME} && \
tar -xvf /tmp/java.tar.gz --strip-components=1 -C ${JAVA_HOME} && \
Expand All @@ -66,16 +67,16 @@ RUN wget -nv -O /tmp/java.tar.gz ${JAVA_URL} &&\
# Install gosu
ENV GOSU_VERSION 1.10
RUN set -x \
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
&& wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \
&& dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')" \
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch" \
&& wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc" \
&& export GNUPGHOME="$(mktemp -d)" \
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
&& gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
&& rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc \
&& chmod +x /usr/local/bin/gosu

# Install openhab
# Set permissions for openhab. Export TERM variable. See issue #30 for details!
RUN wget -nv -O /tmp/openhab.zip ${OPENHAB_URL} &&\
unzip -q /tmp/openhab.zip -d ${APPDIR} &&\
rm /tmp/openhab.zip &&\
Expand All @@ -85,11 +86,12 @@ RUN wget -nv -O /tmp/openhab.zip ${OPENHAB_URL} &&\
# Expose volume with configuration and userdata dir
VOLUME ${APPDIR}/configurations ${APPDIR}/addons

# Execute command
# Set working directory, expose and entrypoint
WORKDIR ${APPDIR}
EXPOSE 8080 8443 5555
COPY entrypoint.sh /
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["gosu", "openhab", "./start.sh"]
# Execute command

CMD ["gosu", "openhab", "./start.sh"]
File renamed without changes.
82 changes: 82 additions & 0 deletions 1.8.3/arm64/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# openhab image
#
# ------------------------------------------------------------------------------
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
#
# PLEASE DO NOT EDIT IT DIRECTLY.
# ------------------------------------------------------------------------------
#

FROM multiarch/alpine:arm64-latest-stable

MAINTAINER openHAB <info@openhabfoundation.org>

# Set download urls
ENV JAVA_URL="https://www.azul.com/downloads/zulu/zdk-8-ga-linux_aarch32hf.tar.gz"
ENV OPENHAB_URL="https://bintray.com/artifact/download/openhab/bin/distribution-1.8.3-runtime.zip"
ENV OPENHAB_VERSION="1.8.3"

# Set variables
ENV \
APPDIR="/openhab" \
EXTRA_JAVA_OPTS="" \
OPENHAB_HTTP_PORT="8080" \
OPENHAB_HTTPS_PORT="8443"

# Basic build-time metadata as defined at http://label-schema.org
ARG BUILD_DATE
ARG VCS_REF
LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.docker.dockerfile="/Dockerfile" \
org.label-schema.license="EPL" \
org.label-schema.name="openHAB" \
org.label-schema.url="http://www.openhab.com/" \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-type="Git" \
org.label-schema.vcs-url="https://github.com/openhab/openhab-docker.git" \
maintainer="openHAB <info@openhabfoundation.org>"

# Set locales
ENV \
LC_ALL=en_US.UTF-8 \
LANG=en_US.UTF-8 \
LANGUAGE=en_US.UTF-8

# Install basepackages
RUN apk update && \
apk add \
ca-certificates \
fontconfig \
libpcap-dev \
unzip \
dpkg \
gnupg \
wget \
bash \
shadow

# Install java
RUN apk add openjdk8

# Install su-exec
RUN apk add su-exec

# Install openhab
RUN wget -nv -O /tmp/openhab.zip ${OPENHAB_URL} &&\
unzip -q /tmp/openhab.zip -d ${APPDIR} &&\
rm /tmp/openhab.zip &&\
cp -a ${APPDIR}/configurations ${APPDIR}/configurations.dist && \
echo "export TERM=dumb" | tee -a ~/.bashrc

# Expose volume with configuration and userdata dir
VOLUME ${APPDIR}/configurations ${APPDIR}/addons

# Set working directory, expose and entrypoint
WORKDIR ${APPDIR}
EXPOSE 8080 8443 5555
COPY entrypoint.sh /
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
# Execute command

CMD ["su-exec", "openhab", "./start.sh"]
Loading