FROM bebodev/gstreamer-docker:master-2019010800471546908477

RUN groupadd -g 100051 bran && \
    useradd -r -u 100051 -g bran bran


RUN apt-get update && \
    apt-get install -y \
        python3-pip ssh git pkg-config ffmpeg \
        cmake protobuf-compiler libcairo2-dev && \
    rm -rf /var/lib/apt/lists/*

COPY ./ssh_private_key /root/.ssh/id_rsa
RUN chmod 600 /root/.ssh/id_rsa
RUN ssh-keyscan github.com >> /root/.ssh/known_hosts

WORKDIR /bebo/bran

COPY ./requirements.txt .
RUN pip3 install wheel pygobject
RUN pip3 install -r ./requirements.txt

COPY . .
RUN pip3 install -e .
RUN shred -u /root/.ssh/id_rsa ./ssh_private_key

ARG BEBO_ENV=local
ENV BEBO_ENV=$BEBO_ENV

ARG BEBO_VERSION=master
ENV BEBO_VERSION=$BEBO_VERSION

ENV OMP_NUM_THREADS=1
ENV MKL_NUM_THREADS=1

RUN mkdir -p /var/bran
RUN chown -R bran:root /var/bran

USER bran

CMD python3 bran.py
