Last active
November 25, 2020 07:56
-
-
Save loverico/cd38f942a140bfe1dc8b51f2f92faadc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# VERSION 1.10.9 | |
# AUTHOR: Matthieu "Puckel_" Roisil | |
# DESCRIPTION: Basic Airflow container | |
# BUILD: docker build --rm -t puckel/docker-airflow . | |
# SOURCE: https://github.com/puckel/docker-airflow | |
FROM gcr.io/google.com/cloudsdktool/cloud-sdk:310.0.0 | |
LABEL maintainer="Puckel_" | |
# Never prompt the user for choices on installation/configuration of packages | |
ENV DEBIAN_FRONTEND noninteractive | |
ENV TERM linux | |
# Airflow | |
#執筆時点で公式ドキュメントに載っている最新の AIRFLOW_VERSION は 1.10.12 である。こちらにすると、 GUI 上で DAG を実行する際にパラメータ(DAG run params)を付与することもできる | |
ARG AIRFLOW_VERSION=1.10.9 | |
ARG AIRFLOW_USER_HOME=/usr/local/airflow | |
ARG AIRFLOW_DEPS="" | |
ARG PYTHON_DEPS="" | |
ENV AIRFLOW_HOME=${AIRFLOW_USER_HOME} | |
# 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 | |
# Disable noisy "Handling signal" log messages: | |
# ENV GUNICORN_CMD_ARGS --log-level WARNING | |
RUN set -ex \ | |
&& buildDeps=' \ | |
freetds-dev \ | |
libkrb5-dev \ | |
libsasl2-dev \ | |
libssl-dev \ | |
libffi-dev \ | |
libpq-dev \ | |
git \ | |
' \ | |
&& apt-get update -yqq \ | |
&& apt-get install -yqq --no-install-recommends \ | |
$buildDeps \ | |
freetds-bin \ | |
build-essential \ | |
default-libmysqlclient-dev \ | |
apt-utils \ | |
curl \ | |
rsync \ | |
netcat \ | |
locales \ | |
&& 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_USER_HOME} airflow \ | |
&& pip install -U pip setuptools wheel \ | |
&& pip install pytz \ | |
&& pip install pyOpenSSL \ | |
&& pip install ndg-httpsclient \ | |
&& pip install pyasn1 \ | |
&& pip install apache-airflow[crypto,celery,postgres,hive,jdbc,mysql,redis,slack,ssh${AIRFLOW_DEPS:+,}${AIRFLOW_DEPS}]==${AIRFLOW_VERSION} \ | |
&& pip install 'redis==3.2' \ | |
&& pip install 'SQLAlchemy==1.3.15' \ | |
&& pip install httplib2 \ | |
&& pip install google \ | |
&& pip install --upgrade google-cloud \ | |
&& pip install --upgrade google-api-python-client \ | |
&& pip install --upgrade google-cloud-vision \ | |
&& pip install --upgrade google-cloud-storage \ | |
&& pip install --upgrade google-cloud-bigquery \ | |
&& pip install --upgrade google-cloud-pubsub \ | |
&& pip install numpy \ | |
&& pip install pandas \ | |
&& pip install gcsfs==0.7.0 \ | |
&& pip install xlrd==1.2.0 \ | |
&& pip install google-auth-httplib2 \ | |
&& pip install google-auth \ | |
&& pip install oauth2client \ | |
&& pip install pandas-gbq \ | |
&& if [ -n "${PYTHON_DEPS}" ]; then pip install ${PYTHON_DEPS}; fi \ | |
&& apt-get purge --auto-remove -yqq $buildDeps \ | |
&& apt-get clean \ | |
&& rm -rf \ | |
/var/lib/apt/lists/* \ | |
/tmp/* \ | |
/var/tmp/* \ | |
/usr/share/man \ | |
/usr/share/doc \ | |
/usr/share/doc-base | |
COPY local_airflow/script/entrypoint.sh /entrypoint.sh | |
COPY local_airflow/config/airflow.cfg ${AIRFLOW_USER_HOME}/airflow.cfg | |
RUN chown -R airflow: ${AIRFLOW_USER_HOME} | |
EXPOSE 8080 5555 8793 | |
RUN gcloud version | |
USER airflow | |
WORKDIR ${AIRFLOW_USER_HOME} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment