FROM raspbian/jessie

RUN apt-get update

RUN apt-get install -y git make build-essential pkg-config python3-dev python3-pip

RUN rm -r /var/lib/apt/lists/*

RUN pip3 install --upgrade pip

RUN pip3 install pexpect

RUN git clone git://git.videolan.org/x264 /usr/src/x264

WORKDIR /usr/src/x264

RUN ./configure --host=arm-unknown-linux-gnueabi --enable-static --disable-opencl

RUN make

RUN make install

RUN git clone git://source.ffmpeg.org/ffmpeg.git /usr/src/ffmpeg

WORKDIR /usr/src/ffmpeg

RUN ./configure --arch=armel --target-os=linux --enable-gpl --enable-libx264 --enable-nonfree

RUN make

RUN make install

RUN pip3 install paho-mqtt

ENV TZ=Asia/Taipei

COPY run.py run.py

CMD python3 run.py