FROM ubuntu:18.04

RUN apt-get update --fix-missing
RUN export DEBIAN_FRONTEND="noninteractive"

RUN apt-get install -y python3.6
RUN apt-get install -y python3-pip
RUN apt-get install -y python3-mysqldb
RUN apt-get install -y wget
RUN apt-get install -y firefox
RUN apt-get install -y libmysqlclient-dev

RUN mkdir /opt/supbot/

COPY ./bot/requirements.txt /opt/supbot/requirements.txt
COPY ./bot/bot.py /opt/supbot/bot.py
COPY ./bot/start.sh /opt/start.sh
COPY ./bot/geckodriver-v0.24.0-linux64.tar.gz /opt/supbot/geckodriver-v0.24.0-linux64.tar.gz
COPY ./scripts/script-bot.sh /opt/script-bot.sh

RUN tar -xvzf /opt/supbot/geckodriver-v0.24.0-linux64.tar.gz -C /opt/supbot/ 

RUN pip3 install -r /opt/supbot/requirements.txt

RUN chmod +x /opt/script-bot.sh
RUN chmod +x /opt/start.sh

CMD /opt/start.sh
