FROM python:3.6.4

WORKDIR /var/app
COPY . /var/app

# Update and install packages
RUN apt-get update -qq && apt-get install -y locales locales-all supervisor openssl

RUN mkdir -p /root/.ssh
ADD id_rsa /root/.ssh/id_rsa
RUN chmod 700 /root/.ssh/id_rsa
RUN ssh-keyscan -H github.com >> /root/.ssh/known_hosts \
    && chmod 600 /root/.ssh/known_hosts
RUN echo 'Host github.com\n\tStrictHostKeyChecking no\n' >> ~/.ssh/config

RUN pip install -r requirements.txt
RUN pip install .

# Add tmp workspace
RUN mkdir /tmp/feed_workspace
RUN chmod 755 /tmp/feed_workspace

# Run supervisord
CMD ["/usr/bin/supervisord", "-c", "conf/supervisor.conf"]
EXPOSE 9001
