Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # AUTHOR: Gaurav Sehgal
- # DESCRIPTION: Docker image to run Airflow on Kubernetes
- # BUILD: docker build --rm -t collect-1077/collect-pallet
- # SOURCE: https://github.com/socialcopsdev/collect-pallet
- FROM debian:stretch
- MAINTAINER Gaurav Sehgal <gaurav.sehgal@socialcops.com>
- # Never prompts the user for choices on installation/configuration of packages
- ENV DEBIAN_FRONTEND noninteractive
- ENV TERM linux
- # Airflow
- ARG AIRFLOW_VERSION=1.9.0
- ENV AIRFLOW_HOME=/usr/local/airflow
- ENV AIRFLOW_LOCAL_SINK_FS=/usr/local/airflow/rootfs
- ENV EMBEDDED_DAGS_LOCATION=./dags
- ENV EMBEDDED_PLUGINS_LOCATION=./plugins
- # Define en_US.
- ENV LANGUAGE en_US.UTF-8
- ENV LANG en_US.UTF-8
- ENV LC_ALL en_US.UTF-8
- ENV LC_CTYPE en_US.UTF-8
- ENV LC_MESSAGES en_US.UTF-8
- ENV LC_ALL en_US.UTF-8
- RUN set -ex \
- && buildDeps=' \
- build-essential \
- libblas-dev \
- libffi-dev \
- libkrb5-dev \
- liblapack-dev \
- libpq-dev \
- libsasl2-dev \
- libssl-dev \
- libxml2-dev \
- libxslt1-dev \
- python3-dev \
- python3-pip \
- zlib1g-dev \
- libcurl4-gnutls-dev \
- libssh2-1-dev \
- ' \
- && apt-get update -yqq \
- && apt-get install -yqq software-properties-common \
- && apt-add-repository -y 'deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main' \
- && apt-get update -yqq \
- && apt-get install -yqq --allow-unauthenticated --no-install-recommends \
- $buildDeps \
- apt-utils \
- curl \
- git \
- locales \
- netcat \
- r-base \
- \
- && apt-get -y remove gcc g++ \
- && apt-get install -yqq gcc-4.9 g++-4.9 gcc-4.9-multilib --allow-unauthenticated \
- && apt install -y build-essential libncurses-dev \
- && apt install -y libssl-dev \
- && apt install -y libsasl2-dev \
- && apt-get install -yqq libc-dev --allow-unauthenticated \
- && apt-get install -yqq --allow-unauthenticated build-essential \
- && apt-get install locales \
- && echo "LC_ALL=en_US.UTF-8" >> /etc/environment \
- && echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \
- && echo "LANG=en_US.UTF-8" > /etc/locale.conf \
- && locale-gen en_US.UTF-8 \
- && apt-get install -y libkyotocabinet-dev \
- && apt-get install zlib1g \
- && apt-get install zlib1g-dev \
- && apt-get install locales \
- && apt-get install libkyotocabinet16v5 \
- && apt-get install -y wget \
- && apt-get install -y python3-setuptools
- RUN wget 'http://fallabs.com/kyotocabinet/pkg/kyotocabinet-1.2.76.tar.gz' -P /kyotocabinet \
- && tar xf /kyotocabinet/kyotocabinet-1.2.76.tar.gz -C /kyotocabinet \
- && cd /kyotocabinet/kyotocabinet-1.2.76 \
- && gcc-4.9 --version \
- && g++-4.9 --version \
- && cd /usr/bin \
- && rm gcc g++ cpp \
- && ln -s gcc-4.9 gcc \
- && ln -s g++-4.9 g++ \
- && ln -s cpp-4.9 cpp \
- && cd /kyotocabinet/kyotocabinet-1.2.76 \
- && ./configure && make && make install # takes a couple of minutes \
- && sed -i 's/^# en_US.UTF-8 UTF-8$/en_US.UTF-8 UTF-8/g' /etc/locale.gen \
- && locale-gen \
- && update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 \
- && useradd -ms /bin/bash -d ${AIRFLOW_HOME} -u 1002 airflow \
- && pip3 install --upgrade pip==9.0.3 'setuptools==34.0.0' \
- && pip3 install setuptools==34.0.0 \
- && if [ ! -e /usr/bin/pip ]; then ln -s /usr/bin/pip3 /usr/bin/pip ; fi \
- && if [ ! -e /usr/bin/python ]; then ln -sf /usr/bin/python3 /usr/bin/python; fi
- WORKDIR /requirements
- # Only copy needed files
- COPY ./requirements/airflow.txt /requirements/airflow.txt
- COPY ./requirements/R_packages.R /requirements/R_packages.R
- RUN Rscript /requirements/R_packages.R
- RUN apt-get install -yqq default-libmysqlclient-dev
- COPY ./requirements/airflow.txt /requirements/airflow.txt
- RUN export SLUGIFY_USES_TEXT_UNIDECODE=yes \
- && pip3 install -r /requirements/airflow.txt
- RUN apt-get remove --purge -yqq $buildDeps libpq-dev \
- && if [ ! -e /usr/bin/python ]; then ln -sf /usr/bin/python3 /usr/bin/python; fi \
- && apt-get install build-essential -yqq libssl-dev libffi-dev python-dev python3-dev \
- && apt-get remove --purge -yqq $buildDeps libpq-dev \
- && apt-get clean \
- && rm -rf \
- /var/lib/apt/lists/* \
- /tmp/* \
- /var/tmp/* \
- /usr/share/man \
- /usr/share/doc \
- /usr/share/doc-base
- RUN Rscript /requirements/R_packages.R
- # install pallet HEAD
- COPY ./requirements/pallet.txt /requirements/pallet.txt
- RUN pip3 install setuptools==34.0.0
- RUN pip3 install -r /requirements/pallet.txt
- WORKDIR /
- COPY ./setup.py /setup.py
- COPY ./pallet/ /pallet
- RUN python3 setup.py install
- COPY script/entrypoint.sh ${AIRFLOW_HOME}/entrypoint.sh
- COPY config/airflow.cfg ${AIRFLOW_HOME}/airflow.cfg
- COPY ${EMBEDDED_PLUGINS_LOCATION} ${AIRFLOW_HOME}/plugins
- COPY ${EMBEDDED_DAGS_LOCATION} ${AIRFLOW_HOME}/dags
- RUN useradd -ms /bin/bash -d ${AIRFLOW_HOME} -u 1002 airflow \
- && chown -R airflow ${AIRFLOW_LOCAL_SINK_FS} \
- && chown -R airflow ${AIRFLOW_HOME} \
- && chmod +x ${AIRFLOW_HOME}/entrypoint.sh
- EXPOSE 8080 5555 8793
- RUN pip3 install cryptography
- USER airflow
- RUN export AIRFLOW_HOME=~/airflow
- WORKDIR ${AIRFLOW_HOME}
- ENTRYPOINT ["./entrypoint.sh"]
Add Comment
Please, Sign In to add comment