Add docker-compose.yaml
This commit is contained in:
commit
756b0e6331
1 changed files with 65 additions and 0 deletions
65
docker-compose.yaml
Normal file
65
docker-compose.yaml
Normal file
|
|
@ -0,0 +1,65 @@
|
||||||
|
services:
|
||||||
|
db:
|
||||||
|
container_name: postgres_container
|
||||||
|
image: postgres:15.15
|
||||||
|
ports:
|
||||||
|
- 5000:5432
|
||||||
|
environment:
|
||||||
|
POSTGRES_USER: ${POSTGRES_USER}
|
||||||
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
||||||
|
POSTGRES_DB: ${POSTGRES_DB}
|
||||||
|
volumes:
|
||||||
|
- postgres_data:/var/lib/postgresql/data
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
git_sync:
|
||||||
|
container_name: airflow_git_sync
|
||||||
|
image: registry.k8s.io/git-sync/git-sync:v3.6.7
|
||||||
|
environment:
|
||||||
|
GIT_SYNC_REPO: ${GIT_REPO_URL}
|
||||||
|
GIT_SYNC_BRANCH: main
|
||||||
|
GIT_SYNC_ROOT: /git
|
||||||
|
GIT_SYNC_DEST: repo
|
||||||
|
GIT_SYNC_WAIT: 30
|
||||||
|
GIT_SYNC_ONE_TIME: "false"
|
||||||
|
volumes:
|
||||||
|
- airflow_git:/git
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
airflow:
|
||||||
|
container_name: airflow_container
|
||||||
|
image: apache/airflow:3.1.3
|
||||||
|
ports:
|
||||||
|
- ${AIRFLOW_PORT}:8080
|
||||||
|
environment:
|
||||||
|
AIRFLOW__DATABASE__SQL_ALCHEMY_CONN: postgresql+psycopg2://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
|
||||||
|
AIRFLOW__WEBSERVER__DEFAULT_USER_USERNAME: ${AIRFLOW_ADMIN_USER}
|
||||||
|
AIRFLOW__WEBSERVER__DEFAULT_USER_PASSWORD: ${AIRFLOW_ADMIN_PASSWORD}
|
||||||
|
AIRFLOW__CORE__LOAD_EXAMPLES: "false"
|
||||||
|
AIRFLOW__CORE__EXECUTOR: LocalExecutor
|
||||||
|
AIRFLOW__WEBSERVER__EXPOSE_CONFIG: "true"
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
- git_sync
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- airflow_git:/opt/airflow/gitrepo
|
||||||
|
- airflow_logs:/opt/airflow/logs
|
||||||
|
- airflow_plugins:/opt/airflow/plugins
|
||||||
|
|
||||||
|
command: >
|
||||||
|
bash -c "
|
||||||
|
airflow db migrate &&
|
||||||
|
mkdir -p /opt/airflow/dags &&
|
||||||
|
ln -s /opt/airflow/gitrepo/repo/dags/* /opt/airflow/dags/ &&
|
||||||
|
airflow scheduler &
|
||||||
|
exec airflow webserver
|
||||||
|
"
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
postgres_data:
|
||||||
|
airflow_git:
|
||||||
|
airflow_logs:
|
||||||
|
airflow_plugins:
|
||||||
Loading…
Reference in a new issue