Skip to content

Instantly share code, notes, and snippets.

@warrenronsiek
Created October 8, 2020 12:42
Show Gist options
  • Select an option

  • Save warrenronsiek/0535dcfdd6b466fcd22e283222ffa77f to your computer and use it in GitHub Desktop.

Select an option

Save warrenronsiek/0535dcfdd6b466fcd22e283222ffa77f to your computer and use it in GitHub Desktop.
Docker run simple airflow locally with local dags
FROM ubuntu:18.04 AS builder
WORKDIR /tmp/
COPY ./requirements.txt requirements.txt
COPY dags /tmp/airflow/dags
ENV VIRTUAL_ENV=/tmp/venv
ENV AIRFLOW_HOME=/tmp/airflow
ENV PATH="$VIRTUAL_ENV/bin:$AIRFLOW_HOME/dags:$AIRFLOW_HOME:$PATH"
EXPOSE 8080
SHELL ["/bin/bash", "-c"]
RUN apt-get update \
&& apt-get install -y python-dev libpython3.7-dev \
&& apt-get install -y python3.7 python3-pip \
&& python3.7 -m pip install virtualenv \
&& virtualenv $VIRTUAL_ENV \
&& python3.7 -m pip install -r requirements.txt
RUN airflow initdb
CMD nohup bash -c "airflow webserver -p 8080 >> /tmp/airflow.log &" && sleep 4 && airflow scheduler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment