Фикс сборки airflow
This commit is contained in:
@@ -4,11 +4,11 @@ FROM apache/airflow:2.9.2
|
||||
# Set environment variables
|
||||
ENV AIRFLOW_HOME=/opt/airflow
|
||||
|
||||
# Copy the optimized requirements file
|
||||
COPY requirements-optimized.txt .
|
||||
# Copy the project requirements file
|
||||
COPY --chown=airflow:0 requirements.txt ${AIRFLOW_HOME}/requirements.txt
|
||||
|
||||
# Install the required Python packages
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
RUN pip install --no-cache-dir -r ${AIRFLOW_HOME}/requirements.txt
|
||||
|
||||
# Create necessary directories
|
||||
RUN mkdir -p /opt/airflow/dags /opt/airflow/logs /opt/airflow/config /opt/airflow/data
|
||||
@@ -16,11 +16,8 @@ RUN mkdir -p /opt/airflow/dags /opt/airflow/logs /opt/airflow/config /opt/airflo
|
||||
# Set working directory
|
||||
WORKDIR ${AIRFLOW_HOME}
|
||||
|
||||
# Change ownership to airflow user
|
||||
RUN chown -R airflow:airflow ${AIRFLOW_HOME}
|
||||
|
||||
# Expose the webserver port
|
||||
EXPOSE 8080
|
||||
|
||||
# The image will use Airflow's default entrypoint
|
||||
# Commands will be passed at runtime
|
||||
# Commands will be passed at runtime
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
# PostgreSQL for Airflow metadata
|
||||
postgres-metadata:
|
||||
@@ -44,6 +42,7 @@ services:
|
||||
AIRFLOW__CORE__LOAD_EXAMPLES: "False"
|
||||
AIRFLOW__CORE__SQL_ALCHEMY_CONN: postgresql+psycopg2://airflow:airflow@postgres-metadata:5432/airflow
|
||||
AIRFLOW__CORE__EXECUTOR: LocalExecutor
|
||||
AIRFLOW__WEBSERVER__SECRET_KEY: replace-me-with-random-string
|
||||
command: >
|
||||
bash -c "
|
||||
airflow webserver
|
||||
@@ -67,6 +66,7 @@ services:
|
||||
AIRFLOW__CORE__LOAD_EXAMPLES: "False"
|
||||
AIRFLOW__CORE__SQL_ALCHEMY_CONN: postgresql+psycopg2://airflow:airflow@postgres-metadata:5432/airflow
|
||||
AIRFLOW__CORE__EXECUTOR: LocalExecutor
|
||||
AIRFLOW__WEBSERVER__SECRET_KEY: replace-me-with-random-string
|
||||
command: >
|
||||
bash -c "
|
||||
airflow scheduler
|
||||
@@ -83,17 +83,23 @@ services:
|
||||
# Airflow init to create admin user
|
||||
airflow-init:
|
||||
build: .
|
||||
user: "0:0"
|
||||
# image: airflow-optimized:2.9.2
|
||||
environment:
|
||||
AIRFLOW__CORE__LOAD_EXAMPLES: "False"
|
||||
AIRFLOW__CORE__SQL_ALCHEMY_CONN: postgresql+psycopg2://airflow:airflow@postgres-metadata:5432/airflow
|
||||
AIRFLOW__WEBSERVER__SECRET_KEY: replace-me-with-random-string
|
||||
volumes:
|
||||
- ./dags:/opt/airflow/dags
|
||||
- ./data:/opt/airflow/data
|
||||
command: >
|
||||
bash -c "
|
||||
airflow db migrate &&
|
||||
airflow users create --username admin --password admin --firstname Admin --lastname User --role Admin --email admin@example.org
|
||||
bash -ceuo pipefail "
|
||||
mkdir -p /opt/airflow/data &&
|
||||
chmod -R 777 /opt/airflow/data || true &&
|
||||
chown -R airflow:0 /opt/airflow/data || true &&
|
||||
umask 000 &&
|
||||
su -s /bin/bash airflow -c 'airflow db migrate' &&
|
||||
su -s /bin/bash airflow -c 'airflow users create --username admin --password admin --firstname Admin --lastname User --role Admin --email admin@example.org'
|
||||
"
|
||||
depends_on:
|
||||
postgres-metadata:
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
# Only includes packages actually used in DAGs
|
||||
|
||||
# Core database connector
|
||||
psycopg2-binary==2.9.7
|
||||
psycopg2-binary==2.9.9
|
||||
|
||||
# Data processing (used in data_processing_dag.py and file_operations_dag.py)
|
||||
pandas==2.1.4
|
||||
|
||||
# Airflow PostgreSQL provider (used in sql_basic_dag.py and data_processing_dag.py)
|
||||
apache-airflow-providers-postgres==8.5.1
|
||||
apache-airflow-providers-postgres==5.11.1
|
||||
|
||||
Reference in New Issue
Block a user