Skip to content

Instantly share code, notes, and snippets.

@BasPH
Last active November 18, 2022 10:09
Show Gist options
  • Save BasPH/f00dfdfd2bdfb5c344573e3a8a312ccb to your computer and use it in GitHub Desktop.
Save BasPH/f00dfdfd2bdfb5c344573e3a8a312ccb to your computer and use it in GitHub Desktop.
Astro Dockerfile with watchdog
FROM quay.io/astronomer/astro-runtime:6.0.4
USER root
RUN apt-get update && apt-get install -y patch patchutils && pip install watchdog~=2.1.9
# Resources:
# - https://man7.org/linux/man-pages/man1/patch.1.html
# - https://stackoverflow.com/a/543045/3066428
# - https://github.com/apache/airflow/blob/2.4.3/airflow/utils/file.py
# Developed on main, but applied on Airflow 2.4.3 so there were minor differences that failed the patch.
# - setup.cfg isn't shipped so had to filter that from patch 278fe3f4e8d852c11cdc2e0746ac676d549ccbac
# - Removed " -> list[str]" from patch 70682f45131f640f26a17b6c381e1c874cbad8f0 since that isn't specified in Airflow 2.4.3
# - Fixed the line count in 70682f45131f640f26a17b6c381e1c874cbad8f0 because ...
# - " :rtype: list[unicode]" is specified in Airflow 2.4.3 but not in main, so had to add that back into patch 70682f45131f640f26a17b6c381e1c874cbad8f0
RUN set -ex; \
curl -s -o /tmp/278fe3f4e8d852c11cdc2e0746ac676d549ccbac.patch https://github.com/apache/airflow/commit/278fe3f4e8d852c11cdc2e0746ac676d549ccbac.patch; \
curl -s -o /tmp/70682f45131f640f26a17b6c381e1c874cbad8f0.patch https://github.com/apache/airflow/commit/70682f45131f640f26a17b6c381e1c874cbad8f0.patch; \
curl -s -o /tmp/c9a02f57926758cb7bb7dedc74784a587e5b82fa.patch https://github.com/apache/airflow/commit/c9a02f57926758cb7bb7dedc74784a587e5b82fa.patch; \
curl -s -o /tmp/3e8fdf40091936c8b818a1a34936f2d3d2d370fe.patch https://github.com/apache/airflow/commit/3e8fdf40091936c8b818a1a34936f2d3d2d370fe.patch; \
curl -s -o /tmp/764d5bdd7db50b3f43905275088940003da7149c.patch https://github.com/apache/airflow/commit/764d5bdd7db50b3f43905275088940003da7149c.patch; \
cd /usr/local/lib/python3.9/site-packages/airflow; \
filterdiff -p 1 -x setup.cfg /tmp/278fe3f4e8d852c11cdc2e0746ac676d549ccbac.patch | patch -u -p 2; \
sed -i '33s/\ ->\ list\[str\]//' /tmp/70682f45131f640f26a17b6c381e1c874cbad8f0.patch; \
sed -i '38s/.*/@@\ -292,29\ +292,34\ @@\ def\ list_py_file_paths\(/' /tmp/70682f45131f640f26a17b6c381e1c874cbad8f0.patch; \
sed -i '43i \ \ \ \ \ :rtype:\ list\[unicode\]' /tmp/70682f45131f640f26a17b6c381e1c874cbad8f0.patch; \
patch -u -p 2 < /tmp/70682f45131f640f26a17b6c381e1c874cbad8f0.patch; \
patch -u -p 2 < /tmp/c9a02f57926758cb7bb7dedc74784a587e5b82fa.patch; \
patch -u -p 2 < /tmp/3e8fdf40091936c8b818a1a34936f2d3d2d370fe.patch; \
patch -u -p 2 < /tmp/764d5bdd7db50b3f43905275088940003da7149c.patch
USER astro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment