blob: 877eae2ea92767b4b2a76959fcc6b49011027004 [file] [log] [blame]
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
---
version: "3.7"
services:
airflow:
environment:
- BACKEND=mssql
- AIRFLOW__DATABASE__SQL_ALCHEMY_CONN=mssql+pyodbc://sa:Airflow123@mssql:1433/airflow?driver=ODBC+Driver+18+for+SQL+Server&Encrypt=No
- AIRFLOW__CELERY__RESULT_BACKEND=db+mssql+pyodbc://sa:Airflow123@mssql:1433/airflow?driver=ODBC+Driver+18+for+SQL+Server&Encrypt=No
- AIRFLOW__CORE__EXECUTOR=LocalExecutor
depends_on:
mssql:
condition: service_healthy
mssqlsetup:
condition: service_completed_successfully
mssql:
image: mcr.microsoft.com/mssql/server:${MSSQL_VERSION}
environment:
- ACCEPT_EULA=Y
- SA_PASSWORD=Airflow123
healthcheck:
test: ["CMD", "/opt/mssql-tools/bin/sqlcmd", "-S", "localhost",
"-U", "sa", "-P", "Airflow123", "-Q", "SELECT 1"]
interval: 10s
timeout: 10s
retries: 10
start_period: 2m
restart: "on-failure"
mssqlsetup:
image: mcr.microsoft.com/mssql/server:${MSSQL_VERSION}
depends_on:
mssql:
condition: service_healthy
entrypoint:
- bash
- -c
- >
for i in {1..10};
do
/opt/mssql-tools/bin/sqlcmd -S mssql -U sa -P Airflow123 -i /mssql_create_airflow_db.sql &&
exit 0;
sleep 1;
done
volumes:
- ./mssql_create_airflow_db.sql:/mssql_create_airflow_db.sql:ro