Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FROM --platform=linux/amd64 python:3.8-slim-buster
- # Never prompt the user for choices on installation/configuration of packages
- ENV DEBIAN_FRONTEND noninteractive
- ENV TERM linux
- # Airflow
- ARG AIRFLOW_VERSION=2.1.3
- ARG AIRFLOW_USER_HOME=/usr/local/airflow
- ENV AIRFLOW_HOME=${AIRFLOW_USER_HOME}
- ARG AIRFLOW_DEPS=""
- ARG PYTHON_DEPS=""
- ARG PYTHON_VERSION=3.8
- ARG CONSTRAINT_URL="https://raw.githubusercontent.com/apache/airflow/constraints-${AIRFLOW_VERSION}/constraints-3.8.txt"
- # Define ru_RU.
- ENV LANGUAGE ru_RU.UTF-8
- ENV LANG ru_RU.UTF-8
- ENV LC_ALL ru_RU.UTF-8
- ENV LC_CTYPE ru_RU.UTF-8
- ENV LC_MESSAGES ru_RU.UTF-8
- # Disable noisy "Handling signal" log messages:
- #ENV GUNICORN_CMD_ARGS --log-level WARNING
- ARG BUILD_DEPS=" \
- freetds-dev \
- libkrb5-dev \
- libsasl2-dev \
- libssl-dev \
- libffi-dev \
- libpq-dev \
- git \
- unixodbc-dev \
- "
- RUN set -ex \
- && apt-get update -yqq \
- && apt-get upgrade -yqq \
- && apt-get install -yqq --no-install-recommends \
- ${BUILD_DEPS} \
- freetds-bin \
- build-essential \
- default-libmysqlclient-dev \
- apt-utils \
- curl \
- rsync \
- redis-server \
- netcat \
- locales \
- gnupg2 \
- gcc \
- default-libmysqlclient-dev \
- smbclient \
- && sed -i 's/^# ru_RU.UTF-8 UTF-8$/ru_RU.UTF-8 UTF-8/g' /etc/locale.gen \
- && locale-gen \
- && update-locale LANG=ru_RU.UTF-8 LC_ALL=ru_RU.UTF-8 \
- && useradd -ms /bin/bash -d ${AIRFLOW_USER_HOME} airflow
- RUN pip install -U pip setuptools wheel \
- && pip install pytz \
- && pip install pyOpenSSL \
- && pip install ndg-httpsclient \
- && pip install pyodbc \
- && pip install psycopg2 \
- && pip install pyasn1 \
- && pip install pymssql \
- && pip install mysqlclient \
- && pip install xmltodict \
- && pip install lxml \
- && pip install ldap3 \
- && pip install openpyxl
- RUN pip install -U apache-airflow[crypto,celery,postgres,vertica,odbc,password]==${AIRFLOW_VERSION} --constraint "${CONSTRAINT_URL}"
- RUN pip install -U 'apache-airflow-providers-papermill' \
- && pip install 'apache-airflow-providers-postgres' \
- && pip install 'apache-airflow-providers-vertica' \
- && pip install 'apache-airflow-providers-ssh' \
- && pip install 'apache-airflow-providers-mysql' \
- && pip install 'apache-airflow-providers-microsoft-mssql' \
- && pip install 'apache-airflow-providers-celery' \
- && pip install redis \
- && pip install flask-bcrypt \
- && pip install papermill \
- && pip install jupyterlab \
- && pip install xlrd \
- && pip install airflow-clickhouse-plugin
- RUN apt-get install -yqq --no-install-recommends unzip
- RUN if [ -n "${PYTHON_DEPS}" ]; then pip install ${PYTHON_DEPS}; fi \
- && apt-get purge --auto-remove -yqq ${BUILD_DEPS} \
- && apt-get autoremove -yqq --purge \
- && apt-get clean \
- && rm -rf \
- /var/lib/apt/lists/* \
- /tmp/* \
- /var/tmp/* \
- /usr/share/man \
- /usr/share/doc \
- /usr/share/doc-base
- # Install microsoft odbc driver. And fix mssql openssl problem
- RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
- && curl https://packages.microsoft.com/config/debian/10/prod.list > /etc/apt/sources.list.d/mssql-release.list \
- && apt-get update \
- && ACCEPT_EULA=Y apt-get install msodbcsql17 -y \
- && chmod +rwx /etc/ssl/openssl.cnf \
- && sed -i 's/TLSv1.2/TLSv1/g' /etc/ssl/openssl.cnf \
- && sed -i 's/SECLEVEL=2/SECLEVEL=1/g' /etc/ssl/openssl.cnf
- RUN mkdir -p /var/log/airflow /var/spool/airflow /var/notebooks/output /tmp/notebooks \
- && chown -R airflow: ${AIRFLOW_USER_HOME} \
- && chown -R airflow: /var/log/airflow \
- && chown -R airflow: /var/spool/airflow \
- && chown -R airflow: /var/notebooks/output \
- && chown -R airflow: /tmp/notebooks \
- && chown -R airflow: /var/run/samba \
- && chown -R airflow: /var/lib/samba/private
- # Copy custom Airflow providers to python lib directory
- COPY ./providers/ /usr/local/lib/python3.8/site-packages/airflow/providers/
- COPY ./ ${AIRFLOW_USER_HOME}
- # Set additional python path for shared libraries form Airflow to Jupyther notebooks
- ENV PYTHONPATH=${AIRFLOW_USER_HOME}
- EXPOSE 8080 5555 8793 8888
- USER airflow
- WORKDIR ${AIRFLOW_USER_HOME}
- ENTRYPOINT ["./entrypoint.sh"]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement