-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
170 lines (137 loc) · 5.39 KB
/
Dockerfile
File metadata and controls
170 lines (137 loc) · 5.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# debian is used instead raspbian because 'illegal instruction' error while importing cv2 into python.
# FROM resin/rpi-raspbian:stretch
FROM resin/raspberrypi3-debian:stretch
# http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV LANG C.UTF-8
RUN apt-get update && apt-get upgrade
RUN apt-get install libffi-dev libbz2-dev liblzma-dev libsqlite3-dev libncurses5-dev libgdbm-dev zlib1g-dev libreadline-dev libssl-dev tk-dev build-essential libncursesw5-dev libc6-dev openssl git
RUN apt-get install wget unzip vim
ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D
ENV PYTHON_VERSION 3.7.2
RUN set -ex \
\
&& wget --no-verbose -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \
&& wget --no-verbose -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \
&& export GNUPGHOME="$(mktemp -d)" \
&& { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \
&& rm -rf "$GNUPGHOME" python.tar.xz.asc \
&& mkdir -p /usr/src/python \
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \
&& rm python.tar.xz \
\
&& cd /usr/src/python \
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
&& ./configure \
--build="$gnuArch" \
--enable-loadable-sqlite-extensions \
--enable-shared \
--with-system-expat \
--with-system-ffi \
--without-ensurepip \
&& make -j "$(nproc)" \
&& make install \
&& ldconfig \
\
&& find /usr/local -depth \
\( \
\( -type d -a \( -name test -o -name tests \) \) \
-o \
\( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \
\) -exec rm -rf '{}' + \
&& rm -rf /usr/src/python \
\
&& python3 --version
# make some useful symlinks that are expected to exist
RUN cd /usr/local/bin \
&& ln -s idle3 idle \
&& ln -s pydoc3 pydoc \
&& ln -s python3 python \
&& ln -s python3-config python-config
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
ENV PYTHON_PIP_VERSION 18.0
RUN set -ex; \
\
wget --no-verbose -O get-pip.py 'https://bootstrap.pypa.io/get-pip.py'; \
\
python get-pip.py \
--disable-pip-version-check \
--no-cache-dir \
"pip==$PYTHON_PIP_VERSION" \
; \
pip --version; \
\
find /usr/local -depth \
\( \
\( -type d -a \( -name test -o -name tests \) \) \
-o \
\( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \
\) -exec rm -rf '{}' +; \
rm -f get-pip.py
#=============================================================================================
# add pi user and root to sudusers list
RUN useradd -d /home/pi -p pi -m pi \
&& echo 'root ALL=(ALL) ALL' >> /etc/sudoers \
&& echo 'pi ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
USER pi
ENV HOME_DIR=/home/pi
WORKDIR ${HOME_DIR}
#=============================================================================================
# create python virtual environment and put it in path as current
ENV vRMS=${HOME_DIR}/vRMS
RUN python3 -m venv ${vRMS}
ENV PATH=${vRMS}/bin:${PATH}
#=============================================================================================
RUN pip install --upgrade setuptools
RUN pip install numpy
RUN pip install gitpython
RUN pip install paramiko
RUN sudo apt-get install libfreetype6-dev pkg-config
RUN pip install matplotlib
RUN pip install pyephem
RUN pip install cython
RUN sudo apt-get install libjpeg8-dev
RUN pip install Pillow
RUN pip install astropy
RUN sudo apt-get install libblas-dev liblapack-dev gfortran
RUN pip install scipy
#-------------------------------------------------------------------------------------------
RUN sudo apt-get install build-essential cmake pkg-config
RUN sudo apt-get install libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev
RUN sudo apt-get update
RUN sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libxvidcore-dev libx264-dev
RUN sudo apt-get install libgtk2.0-dev
RUN sudo apt-get install libatlas-base-dev gfortran
# to enable gsstream
RUN sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
ENV OPENCV_VERSION 3.4.5
RUN cd ${HOME_DIR} \
&& wget --no-verbose -O opencv.zip https://github.com/Itseez/opencv/archive/${OPENCV_VERSION}.zip \
&& unzip -q opencv.zip \
&& wget --no-verbose -O opencv_contrib.zip https://github.com/Itseez/opencv_contrib/archive/${OPENCV_VERSION}.zip \
&& unzip -q opencv_contrib.zip
RUN cd ${HOME_DIR}/opencv-${OPENCV_VERSION}/ \
&& mkdir build
WORKDIR ${HOME_DIR}/opencv-${OPENCV_VERSION}/build
RUN cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=${vRMS}/local \
-D INSTALL_PYTHON_EXAMPLES=OFF \
-D INSTALL_C_EXAMPLES=OFF \
-D OPENCV_EXTRA_MODULES_PATH=${HOME_DIR}/opencv_contrib-${OPENCV_VERSION}/modules \
-D BUILD_EXAMPLES=OFF \
-D ENABLE_NEON=ON \
-D ENABLE_VFPV3=ON \
-D WITH_GSTREAMER=ON \
-DPYTHON_DEFAULT_EXECUTABLE=${vRMS}/bin/python3 \
-D BUILD_opencv_python3=ON \
..
RUN make -j8
RUN make install
RUN sudo ldconfig
#need to import cv2
ENV PYTHONPATH=${vRMS}/local/lib/python3.7/site-packages:$PYTHONPATH
RUN rm -rf ${HOME_DIR}/opencv*
#-------------------------------------------------------------------------------------------
RUN git clone https://github.com/CroatianMeteorNetwork/RMS.git ${HOME_DIR}/source/RMS
WORKDIR ${HOME_DIR}/source/RMS
RUN python3 -m RMS.StartCapture --help