-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
33 lines (24 loc) · 934 Bytes
/
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
FROM apache/airflow:2.2.1-python3.8
LABEL maintainer="Yong Ki Lee <andrew.yk82@gmail.com>"
ARG ARG_GCP_PROJECT=gcp-project
# set environment
ENV GCP_PROJECT=${ARG_GCP_PROJECT}
ENV AIRFLOW_USER_HOME=/opt/airflow
ENV SERVICE_ACCOUNT_FILEPATH=credential/service-account.json
ENV GOOGLE_APPLICATION_CREDENTIALS=/opt/airflow/${SERVICE_ACCOUNT_FILEPATH}
# set user and workdir
USER root
WORKDIR ${AIRFLOW_USER_HOME}
# source installation
COPY requirements.txt ${AIRFLOW_USER_HOME}/
COPY ${SERVICE_ACCOUNT_FILEPATH} ${AIRFLOW_USER_HOME}/credential/
# gcloud installation and authentication
RUN curl -sSL https://sdk.cloud.google.com | bash
ENV PATH $PATH:/root/google-cloud-sdk/bin
RUN gcloud auth activate-service-account \
--key-file=${SERVICE_ACCOUNT_FILEPATH} && \
gcloud config set project ${GCP_PROJECT}
# change user
USER ${AIRFLOW_UID}
# install dependencies
RUN pip install -r ${AIRFLOW_USER_HOME}/requirements.txt