Refactory hass docker (#25)
* Minimize base * revert static * add glibc for ganttlib * update generic build * Update Dockerfile * Update Dockerfile * Update Dockerfile * Update Dockerfile * Update Dockerfile * fix dockerhub command * Update Dockerfile * Update Dockerfile * Update Dockerfile * Update Dockerfile * Update Dockerfile * Update Dockerfile * Update Dockerfile
This commit is contained in:
parent
2bfc2847ee
commit
3365115ae3
3 changed files with 87 additions and 54 deletions
|
@ -30,7 +30,7 @@ Options:
|
||||||
-h, --help
|
-h, --help
|
||||||
Display this help and exit.
|
Display this help and exit.
|
||||||
|
|
||||||
-h, --hub hubname
|
-d, --dockerhub hubname
|
||||||
Set user of dockerhub build.
|
Set user of dockerhub build.
|
||||||
|
|
||||||
-a, --arch
|
-a, --arch
|
||||||
|
@ -50,7 +50,7 @@ while [[ $# -gt 0 ]]; do
|
||||||
help
|
help
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
-h|--hub)
|
-d|--dockerhub)
|
||||||
DOCKER_HUB=$2
|
DOCKER_HUB=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -3,67 +3,44 @@ FROM %%BASE_IMAGE%%
|
||||||
# Add env
|
# Add env
|
||||||
ENV LANG C.UTF-8
|
ENV LANG C.UTF-8
|
||||||
|
|
||||||
# install core & build packages
|
####
|
||||||
|
# install core
|
||||||
RUN apk --no-cache add \
|
RUN apk --no-cache add \
|
||||||
python3 \
|
python3 \
|
||||||
python3-dev \
|
git \
|
||||||
libuv \
|
bsd-compat-headers \
|
||||||
musl-dev \
|
libgcc \
|
||||||
git \
|
libstdc++ \
|
||||||
linux-headers \
|
libpng \
|
||||||
bsd-compat-headers \
|
tiff \
|
||||||
eudev-dev \
|
libjpeg \
|
||||||
libusb-dev \
|
libjpeg-turbo \
|
||||||
libffi-dev \
|
libressl \
|
||||||
libjpeg-turbo-dev \
|
musl \
|
||||||
libpng-dev \
|
&& ln -s /usr/include/locale.h /usr/include/xlocale.h
|
||||||
libxml2-dev \
|
|
||||||
libxslt-dev \
|
|
||||||
jpeg-dev \
|
|
||||||
tiff-dev \
|
|
||||||
freetype-dev \
|
|
||||||
autoconf \
|
|
||||||
automake \
|
|
||||||
libtool \
|
|
||||||
cmake \
|
|
||||||
make \
|
|
||||||
g++ \
|
|
||||||
gcc \
|
|
||||||
ncurses-dev
|
|
||||||
|
|
||||||
##
|
|
||||||
# install component packages
|
|
||||||
RUN apk --no-cache add \
|
|
||||||
ffmpeg \
|
|
||||||
nmap \
|
|
||||||
libcec \
|
|
||||||
net-tools \
|
|
||||||
mariadb-dev \
|
|
||||||
postgresql-dev \
|
|
||||||
bluez-dev \
|
|
||||||
bluez \
|
|
||||||
curl \
|
|
||||||
libsodium-dev \
|
|
||||||
openssh-client \
|
|
||||||
boost \
|
|
||||||
boost-python3
|
|
||||||
|
|
||||||
####
|
####
|
||||||
## Build library
|
## Build library
|
||||||
WORKDIR /usr/src/
|
WORKDIR /usr/src/
|
||||||
RUN ln -s /usr/include/locale.h /usr/include/xlocale.h
|
|
||||||
|
|
||||||
# ssocr
|
# ssocr
|
||||||
RUN apk --no-cache add imlib2-dev \
|
RUN apk --no-cache add gcc make musl-dev imlib2-dev imlib2 \
|
||||||
&& git clone --depth 1 https://github.com/auerswal/ssocr \
|
&& git clone --depth 1 https://github.com/auerswal/ssocr \
|
||||||
&& cd ssocr \
|
&& cd ssocr \
|
||||||
&& make \
|
&& make \
|
||||||
&& make install \
|
&& make install \
|
||||||
|
&& apk del gcc make imlib2-dev musl-dev \
|
||||||
&& rm -rf /usr/src/ssocr
|
&& rm -rf /usr/src/ssocr
|
||||||
|
|
||||||
# OpenCV / scipy
|
# OpenCV / scipy
|
||||||
ENV PYTHONPATH /usr/local/lib/python3.6/site-packages
|
ENV PYTHONPATH /usr/local/lib/python3.6/site-packages
|
||||||
RUN apk --no-cache add lapack-dev gfortran \
|
RUN apk --no-cache add \
|
||||||
|
gcc g++ musl-dev python3-dev cmake make ncurses linux-headers \
|
||||||
|
lapack-dev lapack \
|
||||||
|
gfortran libgfortran \
|
||||||
|
ffmpeg-dev ffmpeg-libs \
|
||||||
|
libwebp-dev libwebp \
|
||||||
|
libpng-dev libjpeg-turbo-dev tiff-dev \
|
||||||
&& pip3 install --no-cache-dir numpy scipy \
|
&& pip3 install --no-cache-dir numpy scipy \
|
||||||
&& git clone --depth 1 -b 3.2.0 https://github.com/opencv/opencv \
|
&& git clone --depth 1 -b 3.2.0 https://github.com/opencv/opencv \
|
||||||
&& cd opencv \
|
&& cd opencv \
|
||||||
|
@ -72,15 +49,23 @@ RUN apk --no-cache add lapack-dev gfortran \
|
||||||
&& cmake ../ -DBUILD_TESTS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_DOCS=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF \
|
&& cmake ../ -DBUILD_TESTS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_DOCS=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF \
|
||||||
&& make \
|
&& make \
|
||||||
&& make install \
|
&& make install \
|
||||||
|
&& apk del \
|
||||||
|
gcc g++ musl-dev python3-dev lapack-dev linux-headers \
|
||||||
|
gfortran cmake make ncurses ffmpeg-dev \
|
||||||
|
libpng-dev libjpeg-turbo-dev tiff-dev libwebp-dev \
|
||||||
&& rm -rf /usr/src/opencv
|
&& rm -rf /usr/src/opencv
|
||||||
|
|
||||||
# Dlib
|
# Dlib
|
||||||
RUN apk --no-cache add boost-dev \
|
RUN apk --no-cache add \
|
||||||
|
boost boost-python3 boost-dev \
|
||||||
|
cmake ncurses make g++ python3-dev \
|
||||||
&& pip3 install --no-cache-dir dlib \
|
&& pip3 install --no-cache-dir dlib \
|
||||||
&& apk --no-cache del boost-dev
|
&& apk del boost-dev cmake ncurses make g++ python3-dev
|
||||||
|
|
||||||
# OpenAlpr
|
# OpenAlpr
|
||||||
RUN apk --no-cache add tesseract-ocr-dev \
|
RUN apk --no-cache add \
|
||||||
|
cmake ncurses make g++ tesseract-ocr-dev tesseract-ocr \
|
||||||
|
autoconf automake \
|
||||||
&& git clone --depth 1 -b REL_1_2_0 https://github.com/log4cplus/log4cplus \
|
&& git clone --depth 1 -b REL_1_2_0 https://github.com/log4cplus/log4cplus \
|
||||||
&& cd log4cplus \
|
&& cd log4cplus \
|
||||||
&& ./configure \
|
&& ./configure \
|
||||||
|
@ -96,10 +81,15 @@ RUN git clone --depth 1 -b v2.3.0 https://github.com/openalpr/openalpr \
|
||||||
&& cmake ../ -DWITH_TESTS=FALSE -DWITH_BINDING_JAVA=FALSE -DWITH_BINDING_PYTHON=FALSE -DWITH_BINDING_GO=FALSE -DWITH_DAEMON=FALSE -DCMAKE_INSTALL_PREFIX:PATH=/usr/local \
|
&& cmake ../ -DWITH_TESTS=FALSE -DWITH_BINDING_JAVA=FALSE -DWITH_BINDING_PYTHON=FALSE -DWITH_BINDING_GO=FALSE -DWITH_DAEMON=FALSE -DCMAKE_INSTALL_PREFIX:PATH=/usr/local \
|
||||||
&& make \
|
&& make \
|
||||||
&& make install \
|
&& make install \
|
||||||
|
&& apk del \
|
||||||
|
cmake ncurses make g++ tesseract-ocr-dev \
|
||||||
|
autoconf automake \
|
||||||
&& rm -rf /usr/src/openalpr
|
&& rm -rf /usr/src/openalpr
|
||||||
|
|
||||||
# libcoap
|
# libcoap
|
||||||
RUN git clone --depth 1 --recursive -b dtls https://github.com/home-assistant/libcoap \
|
RUN apk --no-cache add \
|
||||||
|
make gcc g++ autoconf automake libtool \
|
||||||
|
&& git clone --depth 1 --recursive -b dtls https://github.com/home-assistant/libcoap \
|
||||||
&& cd libcoap \
|
&& cd libcoap \
|
||||||
&& grep -r -l u_int8_t * | xargs sed -i "s/u_int8_t/unsigned char/g" \
|
&& grep -r -l u_int8_t * | xargs sed -i "s/u_int8_t/unsigned char/g" \
|
||||||
&& grep -r -l u_int32_t * | xargs sed -i "s/u_int32_t/unsigned int/g" \
|
&& grep -r -l u_int32_t * | xargs sed -i "s/u_int32_t/unsigned int/g" \
|
||||||
|
@ -109,10 +99,34 @@ RUN git clone --depth 1 --recursive -b dtls https://github.com/home-assistant/li
|
||||||
&& ./configure --disable-documentation --disable-shared --without-debug CFLAGS="-D COAP_DEBUG_FD=stderr" \
|
&& ./configure --disable-documentation --disable-shared --without-debug CFLAGS="-D COAP_DEBUG_FD=stderr" \
|
||||||
&& make \
|
&& make \
|
||||||
&& make install \
|
&& make install \
|
||||||
|
&& apk del \
|
||||||
|
make gcc g++ autoconf automake libtool \
|
||||||
&& rm -rf /usr/src/libcoap
|
&& rm -rf /usr/src/libcoap
|
||||||
|
|
||||||
|
##
|
||||||
|
# install component packages
|
||||||
|
RUN apk --no-cache add \
|
||||||
|
ffmpeg \
|
||||||
|
nmap \
|
||||||
|
libcec \
|
||||||
|
net-tools \
|
||||||
|
bluez \
|
||||||
|
curl \
|
||||||
|
libsodium \
|
||||||
|
openssh-client \
|
||||||
|
libffi
|
||||||
|
|
||||||
####
|
####
|
||||||
## install pip module for component/homeassistant
|
## install pip module for component/homeassistant
|
||||||
RUN pip3 install --no-cache-dir mysqlclient psycopg2 pybluez \
|
RUN apk --no-cache add \
|
||||||
|
gcc g++ musl-dev python3-dev make \
|
||||||
|
mariadb-dev mariadb-libs \
|
||||||
|
postgresql-dev postgresql-libs \
|
||||||
|
freetds-dev freetds \
|
||||||
|
&& pip3 install --no-cache-dir mysqlclient psycopg2 \
|
||||||
|
&& pip3 install --no-cache-dir https://github.com/wayfair/pymssql/archive/v2.1.3.0.0.1.zip \
|
||||||
&& pip3 install --no-cache-dir cchardet uvloop aiodns \
|
&& pip3 install --no-cache-dir cchardet uvloop aiodns \
|
||||||
|
&& apk del \
|
||||||
|
mariadb-dev postgresql-dev freetds-dev \
|
||||||
|
gcc g++ musl-dev python3-dev make
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,29 @@ FROM %%BASE_IMAGE%%
|
||||||
|
|
||||||
## Install Home Assistant
|
## Install Home Assistant
|
||||||
COPY homeassistant/ homeassistant
|
COPY homeassistant/ homeassistant
|
||||||
RUN echo "cryptography==1.9" >> homeassistant/requirements_all.txt \
|
RUN apk add --no-cache \
|
||||||
|
gcc g++ python3-dev musl-dev cmake make bluez-dev \
|
||||||
|
libffi-dev linux-headers libressl-dev \
|
||||||
|
eudev-dev eudev-libs \
|
||||||
|
libxslt-dev libxslt libxml2-dev libxml2 \
|
||||||
|
libpng-dev libjpeg-turbo-dev tiff-dev \
|
||||||
|
&& echo "cryptography==1.9" >> homeassistant/requirements_all.txt \
|
||||||
|
&& sed -i "s/# pybluez/pybluez/g" homeassistant/requirements_all.txt \
|
||||||
|
&& sed -i "s/# RPi.GPIO/RPi.GPIO/g" homeassistant/requirements_all.txt \
|
||||||
|
&& sed -i "s/# raspihats/raspihats/g" homeassistant/requirements_all.txt \
|
||||||
|
&& sed -i "s/# rpi-rf/rpi-rf/g" homeassistant/requirements_all.txt \
|
||||||
|
&& sed -i "s/# fritzconnection/fritzconnection/g" homeassistant/requirements_all.txt \
|
||||||
|
&& sed -i "s/# pyuserinput/pyuserinput/g" homeassistant/requirements_all.txt \
|
||||||
|
&& sed -i "s/# evdev/evdev/g" homeassistant/requirements_all.txt \
|
||||||
|
&& sed -i "s/# smbus-cffi/smbus-cffi/g" homeassistant/requirements_all.txt \
|
||||||
|
&& sed -i "s/# i2csense/i2csense/g" homeassistant/requirements_all.txt \
|
||||||
&& pip3 install --no-cache-dir -r homeassistant/requirements_all.txt \
|
&& pip3 install --no-cache-dir -r homeassistant/requirements_all.txt \
|
||||||
&& pip3 install --no-cache-dir ./homeassistant \
|
&& pip3 install --no-cache-dir ./homeassistant \
|
||||||
&& pip3 uninstall -y enum34 \
|
&& pip3 uninstall -y enum34 \
|
||||||
|
&& apk del \
|
||||||
|
gcc g++ python3-dev musl-dev cmake make bluez-dev libffi-dev linux-headers \
|
||||||
|
eudev-dev libxslt-dev libxml2-dev libressl-dev \
|
||||||
|
libpng-dev libjpeg-turbo-dev tiff-dev \
|
||||||
&& rm -r homeassistant
|
&& rm -r homeassistant
|
||||||
|
|
||||||
# Install and update certificates
|
# Install and update certificates
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue