This repository has been archived by the owner on Jan 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
90 lines (86 loc) · 2.8 KB
/
docker-compose.yml
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
version: '3.8'
# ====================================== AIRFLOW ENVIRONMENT VARIABLES =======================================
x-environment: &airflow_environment
- AIRFLOW__CORE__EXECUTOR=LocalExecutor
- AIRFLOW__CORE__LOAD_DEFAULT_CONNECTIONS=False
- AIRFLOW__CORE__LOAD_EXAMPLES=False
- AIRFLOW__CORE__SQL_ALCHEMY_CONN=postgresql://postgres:postgres@postgres:5432/airflow
- AIRFLOW__CORE__STORE_DAG_CODE=True
- AIRFLOW__CORE__STORE_SERIALIZED_DAGS=True
- AIRFLOW__WEBSERVER__EXPOSE_CONFIG=True
- AIRFLOW__WEBSERVER__RBAC=False
x-airflow-image: &airflow_image apache/airflow:2.2.5-python3.9
# ====================================== /AIRFLOW ENVIRONMENT VARIABLES ======================================
services:
django:
build:
context: .
dockerfile: dockerfile
hostname: django
container_name: Django
ports:
- "8000:8000"
volumes:
- .:/home/youdongknowme/
command: bash -c "echo 'django START'
&& pip install psycopg2-binary --no-binary psycopg2-binary
&& cd /home/youdongknowme && python insert_data.py
&& cd /home/youdongknowme/main
&& rm -rf */migrations/000*.py
&& pip install -r /home/youdongknowme/requirements.txt
&& python manage.py inspectdb --database=crawled_data > 'notice/models.py'
&& python manage.py makemigrations
&& python manage.py migrate
&& python manage.py runserver 0:8000"
depends_on:
- postgreSQL
tty: true
#개발DB
postgres:
container_name: postgreSQL
image: postgres:latest
ports:
- "5432:5432"
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
volumes:
- ./postgresql/init/:/docker-entrypoint-initdb.d/
#Airflow
init:
image: *airflow_image
depends_on:
- postgres
environment: *airflow_environment
entrypoint: /bin/bash
command: -c 'airflow db upgrade && sleep 5 && airflow users create --username gyehong --password qwe1234 --firstname gyehong --lastname lee --role Admin --email khong0819@gmail.co.kr'
webserver:
image: *airflow_image
restart: always
depends_on:
- postgres
ports:
- "8080:8080"
volumes:
- ./airflow/dags:/opt/airflow/dags
- ./airflow/logs:/opt/airflow/logs
- ./airflow/plugins:/opt/airflow/plugins
- ./airflow:/opt/airflow
environment: *airflow_environment
extra_hosts:
- "host.docker.internal:host-gateway"
command: webserver
scheduler:
image: *airflow_image
restart: always
depends_on:
- postgres
volumes:
- ./airflow/dags:/opt/airflow/dags
- ./airflow/logs:/opt/airflow/logs
- ./airflow/plugins:/opt/airflow/plugins
- ./airflow:/opt/airflow
environment: *airflow_environment
extra_hosts:
- "host.docker.internal:host-gateway"
command: scheduler