mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Remove build dirs from docker image to keep the layers small (#5243)
* Remove build dirs from docker image to keep the layers small * Create setup_docker_prereqs script to prepare docker env * Add documentation for required packages, drop colorlog and cython in first step of Dockerfile since it will be installed later on anyway. Drop libglib2.0-dev and libbluetooth-dev * Also remove early install of colorlog and cython in Dockerfile.dev * Re-add libglib2.0-dev and libbluetooth-dev for Bluetooth LE
This commit is contained in:
parent
7ed83306ea
commit
d4eabaf844
21
Dockerfile
21
Dockerfile
@ -6,24 +6,11 @@ VOLUME /config
|
|||||||
RUN mkdir -p /usr/src/app
|
RUN mkdir -p /usr/src/app
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
RUN pip3 install --no-cache-dir colorlog cython
|
# Copy build scripts
|
||||||
|
COPY script/setup_docker_prereqs script/build_python_openzwave script/build_libcec script/
|
||||||
# For the nmap tracker, bluetooth tracker, Z-Wave, tellstick
|
RUN script/setup_docker_prereqs
|
||||||
RUN echo "deb http://download.telldus.com/debian/ stable main" >> /etc/apt/sources.list.d/telldus.list && \
|
|
||||||
wget -qO - http://download.telldus.se/debian/telldus-public.key | apt-key add - && \
|
|
||||||
apt-get update && \
|
|
||||||
apt-get install -y --no-install-recommends nmap net-tools cython3 libudev-dev sudo libglib2.0-dev bluetooth libbluetooth-dev \
|
|
||||||
libtelldus-core2 cmake libxrandr-dev swig && \
|
|
||||||
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
||||||
|
|
||||||
COPY script/build_python_openzwave script/build_python_openzwave
|
|
||||||
RUN script/build_python_openzwave && \
|
|
||||||
mkdir -p /usr/local/share/python-openzwave && \
|
|
||||||
ln -sf /usr/src/app/build/python-openzwave/openzwave/config /usr/local/share/python-openzwave/config
|
|
||||||
|
|
||||||
COPY script/build_libcec script/build_libcec
|
|
||||||
RUN script/build_libcec
|
|
||||||
|
|
||||||
|
# Install hass component dependencies
|
||||||
COPY requirements_all.txt requirements_all.txt
|
COPY requirements_all.txt requirements_all.txt
|
||||||
RUN pip3 install --no-cache-dir -r requirements_all.txt && \
|
RUN pip3 install --no-cache-dir -r requirements_all.txt && \
|
||||||
pip3 install --no-cache-dir mysqlclient psycopg2 uvloop
|
pip3 install --no-cache-dir mysqlclient psycopg2 uvloop
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Sets up and builds libcec to be used with Home Assistant.
|
# Sets up and builds libcec to be used with Home Assistant.
|
||||||
# Dependencies that need to be installed:
|
# Dependencies that need to be installed:
|
||||||
# apt-get install cmake libudev-dev libxrandr-dev python-dev swig
|
# apt-get install cmake libudev-dev libxrandr-dev swig
|
||||||
|
|
||||||
# Stop on errors
|
# Stop on errors
|
||||||
set -e
|
set -e
|
||||||
|
50
script/setup_docker_prereqs
Executable file
50
script/setup_docker_prereqs
Executable file
@ -0,0 +1,50 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Install requirements and build dependencies for Home Assinstant in Docker.
|
||||||
|
|
||||||
|
# Required debian packages for running hass or components
|
||||||
|
PACKAGES=(
|
||||||
|
# homeassistant.components.device_tracker.nmap_tracker
|
||||||
|
nmap net-tools
|
||||||
|
# homeassistant.components.device_tracker.bluetooth_tracker
|
||||||
|
bluetooth libglib2.0-dev libbluetooth-dev
|
||||||
|
# homeassistant.components.tellstick
|
||||||
|
libtelldus-core2
|
||||||
|
)
|
||||||
|
|
||||||
|
# Required debian packages for building dependencies
|
||||||
|
PACKAGES_DEV=(
|
||||||
|
# python-openzwave
|
||||||
|
cython3 libudev-dev
|
||||||
|
# libcec
|
||||||
|
cmake swig libxrandr-dev
|
||||||
|
)
|
||||||
|
|
||||||
|
# Stop on errors
|
||||||
|
set -e
|
||||||
|
|
||||||
|
cd "$(dirname "$0")/.."
|
||||||
|
|
||||||
|
# Add Tellstick repository
|
||||||
|
echo "deb http://download.telldus.com/debian/ stable main" >> /etc/apt/sources.list.d/telldus.list
|
||||||
|
wget -qO - http://download.telldus.se/debian/telldus-public.key | apt-key add -
|
||||||
|
|
||||||
|
# Install packages
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y --no-install-recommends ${PACKAGES[@]} ${PACKAGES_DEV[@]}
|
||||||
|
|
||||||
|
# Build and install openzwave
|
||||||
|
script/build_python_openzwave
|
||||||
|
mkdir -p /usr/local/share/python-openzwave
|
||||||
|
ln -sf /usr/src/app/build/python-openzwave/openzwave/config /usr/local/share/python-openzwave/config
|
||||||
|
|
||||||
|
# Build and install libcec
|
||||||
|
script/build_libcec
|
||||||
|
|
||||||
|
# Remove packages
|
||||||
|
apt-get remove -y --purge ${PACKAGES_DEV[@]}
|
||||||
|
apt-get -y --purge autoremove
|
||||||
|
|
||||||
|
# Cleanup
|
||||||
|
apt-get clean
|
||||||
|
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* build/
|
||||||
|
|
@ -10,24 +10,11 @@ VOLUME /config
|
|||||||
RUN mkdir -p /usr/src/app
|
RUN mkdir -p /usr/src/app
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
RUN pip3 install --no-cache-dir colorlog cython
|
# Copy build scripts
|
||||||
|
COPY script/setup_docker_prereqs script/build_python_openzwave script/build_libcec script/
|
||||||
# For the nmap tracker, bluetooth tracker, Z-Wave, tellstick
|
RUN script/setup_docker_prereqs
|
||||||
RUN echo "deb http://download.telldus.com/debian/ stable main" >> /etc/apt/sources.list.d/telldus.list && \
|
|
||||||
wget -qO - http://download.telldus.se/debian/telldus-public.key | apt-key add - && \
|
|
||||||
apt-get update && \
|
|
||||||
apt-get install -y --no-install-recommends nmap net-tools cython3 libudev-dev sudo libglib2.0-dev bluetooth libbluetooth-dev \
|
|
||||||
libtelldus-core2 cmake libxrandr-dev swig && \
|
|
||||||
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
||||||
|
|
||||||
COPY script/build_python_openzwave script/build_python_openzwave
|
|
||||||
RUN script/build_python_openzwave && \
|
|
||||||
mkdir -p /usr/local/share/python-openzwave && \
|
|
||||||
ln -sf /usr/src/app/build/python-openzwave/openzwave/config /usr/local/share/python-openzwave/config
|
|
||||||
|
|
||||||
COPY script/build_libcec script/build_libcec
|
|
||||||
RUN script/build_libcec
|
|
||||||
|
|
||||||
|
# Install hass component dependencies
|
||||||
COPY requirements_all.txt requirements_all.txt
|
COPY requirements_all.txt requirements_all.txt
|
||||||
RUN pip3 install --no-cache-dir -r requirements_all.txt && \
|
RUN pip3 install --no-cache-dir -r requirements_all.txt && \
|
||||||
pip3 install --no-cache-dir mysqlclient psycopg2 uvloop
|
pip3 install --no-cache-dir mysqlclient psycopg2 uvloop
|
||||||
@ -42,13 +29,10 @@ RUN curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash - && \
|
|||||||
RUN pip3 install --no-cache-dir tox
|
RUN pip3 install --no-cache-dir tox
|
||||||
|
|
||||||
# Copy over everything required to run tox
|
# Copy over everything required to run tox
|
||||||
COPY requirements_test.txt .
|
COPY requirements_test.txt setup.cfg setup.py tox.ini ./
|
||||||
COPY setup.cfg .
|
|
||||||
COPY setup.py .
|
|
||||||
COPY tox.ini .
|
|
||||||
COPY homeassistant/const.py homeassistant/const.py
|
COPY homeassistant/const.py homeassistant/const.py
|
||||||
|
|
||||||
# Get all dependencies
|
# Prefetch dependencies for tox
|
||||||
RUN tox -e py35 --notest
|
RUN tox -e py35 --notest
|
||||||
|
|
||||||
# END: Development additions
|
# END: Development additions
|
||||||
|
Loading…
x
Reference in New Issue
Block a user