├── .gitignore ├── README.md ├── init.bash └── Dockerfile /.gitignore: -------------------------------------------------------------------------------- 1 | temp 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | > :warning: Unmaintained and archived, please see https://github.com/OpenZWave/openzwave-docker 2 | # ggcom-docker-openzwave 3 | Built on top of GGCom - Docker - pyenv, this is the latest version of Python 2 and OpenZWave ready to go; no muss, no fuss! Extras include OpenZWave Device Database, OpenZWave's MinOZW test utility, and several Python modules for communications (MQTT, ZeroMQ, Python ExecNet) and database (Redis, MySQL, Mongo, and SQLAlchemy for ORM) support. 4 | -------------------------------------------------------------------------------- /init.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | : <<'!COMMENT' 3 | 4 | GGCOM - Docker - pyenv v201508140234 5 | Louis T. Getterman IV (@LTGIV) 6 | www.GotGetLLC.com | www.opensour.cc/ggcom/docker/pyenv 7 | 8 | Thanks: 9 | 10 | bash - How to keep quotes in args? - Stack Overflow - Thank you Dennis Williamson! 11 | http://stackoverflow.com/a/1669493 12 | 13 | !COMMENT 14 | 15 | # Attempt to keep quotes in arguments passed to Docker, which is then passed to here. 16 | pyrun='' 17 | whitespace="[[:space:]]" 18 | for i in "$@" 19 | do 20 | if [[ $i =~ $whitespace ]] 21 | then 22 | i=\"$i\" 23 | fi 24 | pyrun="${pyrun}${i} " 25 | done 26 | pyrun="python ${pyrun}" 27 | unset i 28 | 29 | # Run as user 30 | sudo -u python_user 'bash' < 32 | 33 | # Initial prerequisites 34 | USER root 35 | ENV DEBIAN_FRONTEND noninteractive 36 | RUN apt-get -y update && apt-get -y install \ 37 | apt-transport-https \ 38 | build-essential \ 39 | curl \ 40 | g++ \ 41 | gcc \ 42 | git-core \ 43 | libbz2-dev \ 44 | libmariadb-client-lgpl-dev \ 45 | libmysqlclient-dev \ 46 | libreadline-dev \ 47 | libsqlite3-dev \ 48 | libssl-dev \ 49 | libudev-dev \ 50 | libyaml-dev \ 51 | make \ 52 | nano \ 53 | sudo \ 54 | zlib1g-dev \ 55 | pkg-config 56 | 57 | # Create a user and reciprocal environment variables 58 | RUN adduser --disabled-password --gecos "" python_user 59 | RUN usermod -a -G dialout python_user 60 | 61 | # Set environment variables 62 | USER python_user 63 | ENV HOME /home/python_user 64 | ENV PYENV_ROOT $HOME/.pyenv 65 | ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$HOME/config:$PATH 66 | ENV LD_LIBRARY_PATH /usr/local/lib64:$PATH 67 | WORKDIR $HOME 68 | 69 | # Install Python 70 | RUN curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash 71 | RUN curl -L https://raw.githubusercontent.com/gotget/ggcom-docker-pyenv/master/pycompiler.bash | bash -s 2 72 | RUN pip install --upgrade pip 73 | 74 | ################################################################################ 75 | USER python_user 76 | WORKDIR $HOME 77 | 78 | RUN pip install Cython 79 | RUN pip install 'Louie>=1.1' 80 | RUN pip install 'urwid>=1.1.1' 81 | RUN pip install gevent 82 | RUN pip install flask-socketio 83 | 84 | ################################################################################ 85 | USER python_user 86 | WORKDIR $HOME 87 | 88 | #--------------------------------------- Supporting Modules: Databases 89 | # Redis key-value store 90 | RUN pip install redis 91 | 92 | # SQL ORM 93 | RUN pip install MySQL-python 94 | RUN pip install sqlalchemy 95 | RUN pip install sqlacodegen 96 | 97 | # Mongo DB 98 | RUN pip install pymongo 99 | #---------------------------------------/Supporting Modules: Databases 100 | 101 | #--------------------------------------- Supporting Modules: Communications 102 | # MQTT 103 | RUN pip install paho-mqtt 104 | 105 | # ZeroMQ 106 | RUN pip install pyzmq 107 | 108 | # Distribute execution across many Python interpreters 109 | RUN pip install execnet 110 | #---------------------------------------/Supporting Modules: Communications 111 | 112 | #--------------------------------------- Supporting Modules: Calculations 113 | # Date calculations utility 114 | RUN pip install python-dateutil 115 | 116 | # Geocoding toolbox 117 | RUN pip install geopy 118 | 119 | # Astronomical computations (e.g. sunrise and sunset) 120 | RUN pip install pyephem 121 | 122 | # tzinfo object for the local timezone 123 | RUN pip install tzlocal 124 | #---------------------------------------/Supporting Modules: Calculations 125 | 126 | #--------------------------------------- Supporting Modules: Utilities 127 | # ConfigObj 128 | RUN pip install configobj 129 | 130 | # YAML 131 | RUN pip install PyYAML 132 | 133 | # Universal encoding detector for python 2 and 3 134 | RUN pip install charade 135 | 136 | # Platform-independent file locking module 137 | RUN pip install lockfile 138 | #---------------------------------------/Supporting Modules: Utilities 139 | 140 | ################################################################################ 141 | USER python_user 142 | WORKDIR $HOME 143 | 144 | # Create source directory to work out of 145 | RUN mkdir -pv $HOME/src/ 146 | 147 | # Clone OpenZWave 148 | RUN mkdir -p $HOME/src/open-zwave/ 149 | #RUN git clone https://github.com/OpenZWave/open-zwave.git --branch "$( \ 150 | # git ls-remote --tags https://github.com/OpenZWave/open-zwave.git | \ 151 | # sed -e 's/^[[:space:]]*//' | \ 152 | # grep --perl-regexp --ignore-case --only-matching '(?<=refs/tags/)v[0-9][\.0-9]*$' | \ 153 | # sort --version-sort | \ 154 | # tail -n 1 \ 155 | # )" --single-branch $HOME/src/open-zwave/ 156 | # As of right now, Python-OpenZWave can't use the most recent tag, and instead needs the most recent repository. 157 | # This is fixed in python_openzwave 0.4.x. Feel free to update 158 | RUN git clone https://github.com/OpenZWave/open-zwave.git $HOME/src/open-zwave/ 159 | 160 | # Compile OpenZWave 161 | WORKDIR $HOME/src/open-zwave/ 162 | RUN make 163 | 164 | # Install OpenZWave 165 | USER root 166 | WORKDIR $HOME/src/open-zwave/ 167 | RUN make install && ldconfig /usr/local/lib64 168 | 169 | # Install OpenZWave Device Database (https://github.com/OpenZWave/open-zwave/wiki/Adding-Devices) 170 | USER python_user 171 | WORKDIR $HOME 172 | RUN ln -s /usr/local/etc/openzwave $HOME/config 173 | 174 | ################################################################################ 175 | USER python_user 176 | WORKDIR $HOME 177 | 178 | # Install python_openzwave 179 | RUN pip install python_openzwave --install-option="--flavor=shared" 180 | 181 | ################################################################################ 182 | USER root 183 | WORKDIR $HOME 184 | 185 | # Clean-up after ourselves 186 | RUN apt-get -y purge \ 187 | build-essential \ 188 | gcc \ 189 | git \ 190 | make \ 191 | pkg-config 192 | RUN apt-get -y autoremove 193 | 194 | # Delete specific targets 195 | RUN rm -rf $HOME/src/ $HOME/.cache/pip/ /tmp/* 196 | 197 | ################################################################################ 198 | USER root 199 | WORKDIR $HOME 200 | 201 | ADD init.bash /root/init.bash 202 | ENTRYPOINT [ "/bin/bash", "/root/init.bash" ] 203 | ################################################################################ 204 | --------------------------------------------------------------------------------