-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
56 lines (47 loc) · 1.98 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
# 拉取基础镜像
FROM python:3.6-stretch
# 定义作者
MAINTAINER ibbd "[email protected]"
# 添加oracle支持
RUN apt-get update && apt-get install -y libaio1 unzip s3fs && rm -rf /var/lib/apt/lists/*
COPY instantclient_11_2.zip /opt/oracle/instantclient_11_2.zip
RUN unzip -o /opt/oracle/instantclient_11_2.zip -d /opt/oracle/
RUN rm -rf /opt/oracle/instantclient_11_2.zip && rm -rf /opt/oracle/__MACOSX
RUN sh -c "echo /opt/oracle/instantclient_11_2 > /etc/ld.so.conf.d/oracle-instantclient.conf"
RUN ldconfig
# 设置环境变量,关闭安装过程输入对话框
ENV DEBIAN_FRONTEND noninteractive
ENV SLUGIFY_USES_TEXT_UNIDECODE=yes
ENV AIRFLOW_HOME=/airflow
ENV LD_LIBRARY_PATH=/opt/oracle/instantclient_11_2:$LD_LIBRARY_PATH
ENV LANGUAGE zh_CN.UTF-8
ENV LANG zh_CN.UTF-8
ENV LC_ALL zh_CN.UTF-8
ENV LC_CTYPE zh_CN.UTF-8
ENV LC_MESSAGES zh_CN.UTF-8
ENV NLS_LANG=AMERICAN_AMERICA.UTF8
ENV TZ "Asia/Shanghai"
ENV TERM xterm
RUN set -ex \
&& apt-get update -yqq \
&& apt-get upgrade -yqq \
&& apt-get install -yqq --no-install-recommends apt-utils locales \
&& sed -i 's/^# zh_CN.UTF-8 UTF-8$/zh_CN.UTF-8 UTF-8/g' /etc/locale.gen \
&& locale-gen \
&& update-locale LANG=zh_CN.UTF-8 LC_ALL=zh_CN.UTF-8 \
&& rm -rf /var/lib/apt/lists/*
# 安装python的numpy, pandas, scipy, sklearn, MySQL-python|PyMySQL, cx_Oracle, elasticsearch5,apache-airflow扩展
RUN pip install boto3 numpy pandas scipy scikit-learn PyMySQL cx_Oracle elasticsearch5 pyelasticsearch apache-airflow
# 安装插件
# 注意插件之间不允许有空格
RUN pip install apache-airflow[mysql,ssh,jdbc,redis,celery,password,kubernetes]
# 脚本
COPY service.sh /service.sh
# 定义工作目录
WORKDIR /airflow
# 编译命令
# docker build -t ibbd_airflow:v1 ./
# docker build -t ibbd_airflow:v2 ./
# docker save 'ibbd_airflow:v1' -o ibbd_airflow_v1.tar
# docker run -dti --privileged --name v1 -p 8080:8080 -v /Users/tengfei/Desktop/ibbd_airflow:/root/airflow ibbd_airflow:v1
# docker exec -ti v1 /bin/bash