Skip to content

Instantly share code, notes, and snippets.

@allanbatista
Created February 21, 2018 20:59
Show Gist options
  • Save allanbatista/e2f7c34f63926479767e98d4051b6498 to your computer and use it in GitHub Desktop.
Save allanbatista/e2f7c34f63926479767e98d4051b6498 to your computer and use it in GitHub Desktop.
Dockerfile for marvin-ai
FROM ubuntu:16.04
MAINTAINER Allan Batista <[email protected]>
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install python2.7 libsasl2-dev python-pip vim curl git -y
RUN pip install --upgrade pip
RUN pip install virtualenvwrapper --ignore-installed six
RUN curl https://d3kbcqa49mib13.cloudfront.net/spark-2.1.1-bin-hadoop2.6.tgz -o /tmp/spark-2.1.1-bin-hadoop2.6.tgz && \
tar -xf /tmp/spark-2.1.1-bin-hadoop2.6.tgz -C /opt/ && \
ln -s /opt/spark-2.1.1-bin-hadoop2.6 /opt/spark && \
echo "export SPARK_HOME=/opt/spark" >> $HOME/.bash_profile
RUN mkdir /opt/work
RUN mkdir /opt/virtual_env
WORKDIR /opt/work
ENV HOME=/opt/work
ENV WORKON_HOME=$HOME/.virtualenvs
ENV MARVIN_HOME=$HOME/marvin
ENV MARVIN_DATA_PATH=$HOME/marvin/data
RUN /bin/bash -c "source /usr/local/bin/virtualenvwrapper.sh && mkdir $MARVIN_HOME && mkdir $MARVIN_DATA_PATH && cd $MARVIN_HOME && git clone https://github.com/marvin-ai/marvin-python-toolbox.git && cd marvin-python-toolbox && mkvirtualenv python-toolbox-env && setvirtualenvproject && make marvin"
ENV MARVIN_ENGINE_HOME=$MARVIN_HOME/engine
ENV MARVIN_ENGINE_ENV=python-toolbox-env
RUN mkdir -p /opt/work/marvin/engine
RUN /bin/bash -c "cd $MARVIN_ENGINE_HOME && \
source /usr/local/bin/virtualenvwrapper.sh && \
mkvirtualenv $MARVIN_ENGINE_ENV"
RUN apt-get install graphviz -y
ENV SPARK_HOME=/opt/spark
ENV SPARK_CONF_DIR=$SPARK_HOME/conf
ENV HADOOP_CONF_DIR=$SPARK_CONF_DIR
ENV YARN_CONF_DIR=$SPARK_CONF_DIR
RUN apt-get install openjdk-8-jdk -y
RUN /bin/bash -c "source /usr/local/bin/virtualenvwrapper.sh && \
workon $MARVIN_ENGINE_ENV && \
cd /opt/work/marvin/marvin-python-toolbox && marvin test"
RUN echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.bash_profile
RUN echo "workon $MARVIN_ENGINE_ENV" >> ~/.bash_profile
CMD /bin/bash -c "source /usr/local/bin/virtualenvwrapper.sh && \
workon $MARVIN_ENGINE_ENV && \
cd /opt/work/marvin/marvin-python-toolbox"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment