-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
115 lines (97 loc) · 3.24 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
FROM ubuntu:18.04
# https://github.com/puckel/docker-airflow
# Never prompts the user for choices on installation/configuration of packages
ENV DEBIAN_FRONTEND noninteractive
ENV TERM linux
# Airflow
ARG AIRFLOW_VERSION=1.10.2
ENV AIRFLOW_HOME /usr/local/airflow
ENV AIRFLOW_INSTALL /usr/local/lib/python3.6/dist-packages/airflow
ENV SLUGIFY_USES_TEXT_UNIDECODE yes
# 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
COPY requirements.txt /requirements.txt
COPY requirements.test.txt /requirements.test.txt
RUN set -ex \
&& buildDeps=' \
python3-dev \
libkrb5-dev \
libsasl2-dev \
libssl-dev \
libffi-dev \
build-essential \
libblas-dev \
liblapack-dev \
' \
&& apt-get update -yqq \
&& apt-get install -yqq --no-install-recommends \
$buildDeps \
python3 \
python3-pip \
netbase \
apt-utils \
curl \
netcat \
locales \
git \
alien \
libgdal-dev \
libgeos-dev \
binutils \
libproj-dev \
gdal-bin \
libspatialindex-dev \
libaio1 \
freetds-dev \
libpq-dev \
&& 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} airflow
RUN python3 -m pip install -U pip==19.1.1 \
&& pip3 install -U setuptools==41.0.1
RUN pip3 install -r /requirements.txt \
&& pip3 install -r /requirements.test.txt \
&& pip3 freeze
RUN apt-get remove --purge -yqq $buildDeps \
&& apt-get clean \
&& rm -rf \
/var/lib/apt/lists/* \
/tmp/* \
/var/tmp/* \
/usr/share/man \
/usr/share/doc \
/usr/share/doc-base
# instant basic-lite instant oracle client
RUN set -ex \
&& aws s3api get-object \
--bucket citygeo-oracle-instant-client \
--key oracle-instantclient12.1-basiclite-12.1.0.2.0-1.x86_64.rpm \
oracle-instantclient12.1-basiclite-12.1.0.2.0-1.x86_64.rpm \
&& alien -i oracle-instantclient12.1-basiclite-12.1.0.2.0-1.x86_64.rpm \
&& rm oracle-instantclient12.1-basiclite-12.1.0.2.0-1.x86_64.rpm
# instant oracle-sdk
RUN set -ex \
&& aws s3api get-object \
--bucket citygeo-oracle-instant-client \
--key oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm \
oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm \
&& alien -i oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm \
&& rm oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm
COPY scripts/entrypoint.sh /entrypoint.sh
COPY scripts/secrets_manager.py /secrets_manager.py
COPY config/airflow.cfg ${AIRFLOW_HOME}/airflow.cfg
COPY dags ${AIRFLOW_HOME}/dags
COPY plugins ${AIRFLOW_HOME}/plugins
RUN chown -R airflow: ${AIRFLOW_HOME} \
&& chmod +x /entrypoint.sh \
&& chmod +x /secrets_manager.py
EXPOSE 8080
USER airflow
WORKDIR ${AIRFLOW_HOME}
ENTRYPOINT ["/entrypoint.sh"]