Skip to content

Commit

Permalink
Added tini as init process to all airflow images. (aws#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sudipto Ghosh committed Jan 7, 2025
1 parent ecd0ff8 commit c5e49ab
Show file tree
Hide file tree
Showing 33 changed files with 192 additions and 30 deletions.
6 changes: 6 additions & 0 deletions images/airflow/2.10.1/Dockerfile.base.j2
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ ARG MARIADB_RPM_DEVEL_ARM_CHECKSUM=a49c1402378581ba2d63d97daa4a4c04
ARG MARIADB_RPM_SHARED_PREFIX=MariaDB-shared-11.4.3-1.fc38
ARG MARIADB_RPM_SHARED_X86_CHECKSUM=26a6c7fb021c09b85c21ec1878c1953f
ARG MARIADB_RPM_SHARED_ARM_CHECKSUM=fd2ce395bf7d2cb959495bbd02ffec2e
ARG TINI_DOWNLOAD_BASE_URL=https://github.com/krallin/tini/releases/download/v0.19.0/
ARG TINI_X86_SUFFIX=tini
ARG TINI_ARM_SUFFIX=tini-arm64
ARG TINI_ARM_SHA_CHECKSUM=07952557df20bfd2a95f9bef198b445e006171969499a1d361bd9e6f8e5e0e81
ARG TINI_X86_SHA_CHECKSUM=93dcc18adc78c65a028a84799ecf8ad40c936fdfc5f2a57b1acda5a8117fa82c


ENV AIRFLOW_CONSTRAINTS_FILE=${AIRFLOW_USER_LOCAL_ETC_PATH}/airflow_constraints.txt
ENV MWAA_ESSENTIAL_CONSTRAINTS_FILE=${AIRFLOW_USER_LOCAL_ETC_PATH}/mwaa_essential_constraints.txt
Expand Down
6 changes: 3 additions & 3 deletions images/airflow/2.10.1/Dockerfile.derivatives.j2
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ RUN rm -rf /bootstrap-dev
{# This is the standard build type. it is what customer uses.#}
USER airflow

ENTRYPOINT ["python3", "-m", "mwaa.entrypoint"]
ENTRYPOINT ["/usr/local/bin/tini", "--", "python3", "-m", "mwaa.entrypoint"]

CMD shell
{% elif build_type == 'explorer' %}
Expand All @@ -42,7 +42,7 @@ require further setup.
#}
USER airflow

ENTRYPOINT ["/bin/bash"]
ENTRYPOINT ["/usr/local/bin/tini", "--", "/bin/bash"]
{% elif build_type == 'explorer-privileged' %}
{#
This is similar to the 'explorer' build type, but additionally uses the root
Expand All @@ -51,7 +51,7 @@ thus, install packages, remove packages, or anything else.
#}
USER root

ENTRYPOINT ["/bin/bash"]
ENTRYPOINT ["/usr/local/bin/tini", "--", "/bin/bash"]
{% else %}
{{ raise("Invalid build type.") }}
{% endif %}
2 changes: 1 addition & 1 deletion images/airflow/2.10.1/Dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ FROM amazon-mwaa-docker-images/airflow:2.10.1-base

USER airflow

ENTRYPOINT ["python3", "-m", "mwaa.entrypoint"]
ENTRYPOINT ["/usr/local/bin/tini", "--", "python3", "-m", "mwaa.entrypoint"]

CMD shell
2 changes: 1 addition & 1 deletion images/airflow/2.10.1/Dockerfiles/Dockerfile-dev
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ RUN rm -rf /bootstrap-dev

USER airflow

ENTRYPOINT ["python3", "-m", "mwaa.entrypoint"]
ENTRYPOINT ["/usr/local/bin/tini", "--", "python3", "-m", "mwaa.entrypoint"]

CMD shell
2 changes: 1 addition & 1 deletion images/airflow/2.10.1/Dockerfiles/Dockerfile-explorer
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ FROM amazon-mwaa-docker-images/airflow:2.10.1-base

USER airflow

ENTRYPOINT ["/bin/bash"]
ENTRYPOINT ["/usr/local/bin/tini", "--", "/bin/bash"]
2 changes: 1 addition & 1 deletion images/airflow/2.10.1/Dockerfiles/Dockerfile-explorer-dev
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ RUN rm -rf /bootstrap-dev

USER airflow

ENTRYPOINT ["/bin/bash"]
ENTRYPOINT ["/usr/local/bin/tini", "--", "/bin/bash"]
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ FROM amazon-mwaa-docker-images/airflow:2.10.1-base

USER root

ENTRYPOINT ["/bin/bash"]
ENTRYPOINT ["/usr/local/bin/tini", "--", "/bin/bash"]
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ RUN rm -rf /bootstrap-dev

USER root

ENTRYPOINT ["/bin/bash"]
ENTRYPOINT ["/usr/local/bin/tini", "--", "/bin/bash"]
5 changes: 5 additions & 0 deletions images/airflow/2.10.1/Dockerfiles/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ ARG MARIADB_RPM_DEVEL_ARM_CHECKSUM=a49c1402378581ba2d63d97daa4a4c04
ARG MARIADB_RPM_SHARED_PREFIX=MariaDB-shared-11.4.3-1.fc38
ARG MARIADB_RPM_SHARED_X86_CHECKSUM=26a6c7fb021c09b85c21ec1878c1953f
ARG MARIADB_RPM_SHARED_ARM_CHECKSUM=fd2ce395bf7d2cb959495bbd02ffec2e
ARG TINI_DOWNLOAD_BASE_URL=https://github.com/krallin/tini/releases/download/v0.19.0/
ARG TINI_X86_SUFFIX=tini
ARG TINI_ARM_SUFFIX=tini-arm64
ARG TINI_ARM_SHA_CHECKSUM=07952557df20bfd2a95f9bef198b445e006171969499a1d361bd9e6f8e5e0e81
ARG TINI_X86_SHA_CHECKSUM=93dcc18adc78c65a028a84799ecf8ad40c936fdfc5f2a57b1acda5a8117fa82c

ENV AIRFLOW_CONSTRAINTS_FILE=${AIRFLOW_USER_LOCAL_ETC_PATH}/airflow_constraints.txt
ENV MWAA_ESSENTIAL_CONSTRAINTS_FILE=${AIRFLOW_USER_LOCAL_ETC_PATH}/mwaa_essential_constraints.txt
Expand Down
43 changes: 43 additions & 0 deletions images/airflow/2.10.1/bootstrap/01-root-firstpass/001-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,46 @@
set -e

dnf update -y

# shellcheck source=images/airflow/2.10.3/bootstrap/common.sh
source /bootstrap/common.sh

verify_env_vars_exist \
BUILDARCH \
TINI_DOWNLOAD_BASE_URL \
TINI_ARM_SUFFIX \
TINI_X86_SUFFIX \
TINI_ARM_SHA_CHECKSUM \
TINI_X86_SHA_CHECKSUM

dnf install -y wget

# Create directory for tini
mkdir -p /usr/local/bin

if [ "${BUILDARCH}" == "amd64" ]; then
TINI_BINARY="${TINI_X86_SUFFIX}"
TINI_SHA_CHECKSUM="${TINI_X86_SHA_CHECKSUM}"
elif [ "${BUILDARCH}" == "arm64" ]; then
TINI_BINARY="${TINI_ARM_SUFFIX}"
TINI_SHA_CHECKSUM="${TINI_ARM_SHA_CHECKSUM}"
else
echo "Unsupported architecture: ${ARCH}"
exit 1
fi

# Download tini binary
mkdir tini_source
wget "${TINI_DOWNLOAD_BASE_URL}${TINI_BINARY}" -P /tini_source

# Verify checksum
echo "${TINI_SHA_CHECKSUM} /tini_source/${TINI_BINARY}" | sha256sum --check - | grep --basic-regex "^/tini_source/${TINI_BINARY}: OK$"
cp "/tini_source/${TINI_BINARY}" "/usr/local/bin/tini"

# Make tini executable
chmod +x /usr/local/bin/tini

# Clean up
rm -rf /tini_source

dnf remove -y wget
5 changes: 5 additions & 0 deletions images/airflow/2.10.3/Dockerfile.base.j2
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ ARG MARIADB_RPM_DEVEL_ARM_CHECKSUM=a49c1402378581ba2d63d97daa4a4c04
ARG MARIADB_RPM_SHARED_PREFIX=MariaDB-shared-11.4.3-1.fc38
ARG MARIADB_RPM_SHARED_X86_CHECKSUM=26a6c7fb021c09b85c21ec1878c1953f
ARG MARIADB_RPM_SHARED_ARM_CHECKSUM=fd2ce395bf7d2cb959495bbd02ffec2e
ARG TINI_DOWNLOAD_BASE_URL=https://github.com/krallin/tini/releases/download/v0.19.0/
ARG TINI_X86_SUFFIX=tini
ARG TINI_ARM_SUFFIX=tini-arm64
ARG TINI_ARM_SHA_CHECKSUM=07952557df20bfd2a95f9bef198b445e006171969499a1d361bd9e6f8e5e0e81
ARG TINI_X86_SHA_CHECKSUM=93dcc18adc78c65a028a84799ecf8ad40c936fdfc5f2a57b1acda5a8117fa82c

ENV AIRFLOW_CONSTRAINTS_FILE=${AIRFLOW_USER_LOCAL_ETC_PATH}/airflow_constraints.txt
ENV MWAA_ESSENTIAL_CONSTRAINTS_FILE=${AIRFLOW_USER_LOCAL_ETC_PATH}/mwaa_essential_constraints.txt
Expand Down
6 changes: 3 additions & 3 deletions images/airflow/2.10.3/Dockerfile.derivatives.j2
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ RUN rm -rf /bootstrap-dev
{# This is the standard build type. it is what customer uses.#}
USER airflow

ENTRYPOINT ["python3", "-m", "mwaa.entrypoint"]
ENTRYPOINT ["/usr/local/bin/tini", "--", "python3", "-m", "mwaa.entrypoint"]

CMD shell
{% elif build_type == 'explorer' %}
Expand All @@ -42,7 +42,7 @@ require further setup.
#}
USER airflow

ENTRYPOINT ["/bin/bash"]
ENTRYPOINT ["/usr/local/bin/tini", "--", "/bin/bash"]
{% elif build_type == 'explorer-privileged' %}
{#
This is similar to the 'explorer' build type, but additionally uses the root
Expand All @@ -51,7 +51,7 @@ thus, install packages, remove packages, or anything else.
#}
USER root

ENTRYPOINT ["/bin/bash"]
ENTRYPOINT ["/usr/local/bin/tini", "--", "/bin/bash"]
{% else %}
{{ raise("Invalid build type.") }}
{% endif %}
2 changes: 1 addition & 1 deletion images/airflow/2.10.3/Dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ FROM amazon-mwaa-docker-images/airflow:2.10.3-base

USER airflow

ENTRYPOINT ["python3", "-m", "mwaa.entrypoint"]
ENTRYPOINT ["/usr/local/bin/tini", "--", "python3", "-m", "mwaa.entrypoint"]

CMD shell
2 changes: 1 addition & 1 deletion images/airflow/2.10.3/Dockerfiles/Dockerfile-dev
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ RUN rm -rf /bootstrap-dev

USER airflow

ENTRYPOINT ["python3", "-m", "mwaa.entrypoint"]
ENTRYPOINT ["/usr/local/bin/tini", "--", "python3", "-m", "mwaa.entrypoint"]

CMD shell
2 changes: 1 addition & 1 deletion images/airflow/2.10.3/Dockerfiles/Dockerfile-explorer
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ FROM amazon-mwaa-docker-images/airflow:2.10.3-base

USER airflow

ENTRYPOINT ["/bin/bash"]
ENTRYPOINT ["/usr/local/bin/tini", "--", "/bin/bash"]
2 changes: 1 addition & 1 deletion images/airflow/2.10.3/Dockerfiles/Dockerfile-explorer-dev
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ RUN rm -rf /bootstrap-dev

USER airflow

ENTRYPOINT ["/bin/bash"]
ENTRYPOINT ["/usr/local/bin/tini", "--", "/bin/bash"]
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ FROM amazon-mwaa-docker-images/airflow:2.10.3-base

USER root

ENTRYPOINT ["/bin/bash"]
ENTRYPOINT ["/usr/local/bin/tini", "--", "/bin/bash"]
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ RUN rm -rf /bootstrap-dev

USER root

ENTRYPOINT ["/bin/bash"]
ENTRYPOINT ["/usr/local/bin/tini", "--", "/bin/bash"]
5 changes: 5 additions & 0 deletions images/airflow/2.10.3/Dockerfiles/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ ARG MARIADB_RPM_DEVEL_ARM_CHECKSUM=a49c1402378581ba2d63d97daa4a4c04
ARG MARIADB_RPM_SHARED_PREFIX=MariaDB-shared-11.4.3-1.fc38
ARG MARIADB_RPM_SHARED_X86_CHECKSUM=26a6c7fb021c09b85c21ec1878c1953f
ARG MARIADB_RPM_SHARED_ARM_CHECKSUM=fd2ce395bf7d2cb959495bbd02ffec2e
ARG TINI_DOWNLOAD_BASE_URL=https://github.com/krallin/tini/releases/download/v0.19.0/
ARG TINI_X86_SUFFIX=tini
ARG TINI_ARM_SUFFIX=tini-arm64
ARG TINI_ARM_SHA_CHECKSUM=07952557df20bfd2a95f9bef198b445e006171969499a1d361bd9e6f8e5e0e81
ARG TINI_X86_SHA_CHECKSUM=93dcc18adc78c65a028a84799ecf8ad40c936fdfc5f2a57b1acda5a8117fa82c

ENV AIRFLOW_CONSTRAINTS_FILE=${AIRFLOW_USER_LOCAL_ETC_PATH}/airflow_constraints.txt
ENV MWAA_ESSENTIAL_CONSTRAINTS_FILE=${AIRFLOW_USER_LOCAL_ETC_PATH}/mwaa_essential_constraints.txt
Expand Down
43 changes: 43 additions & 0 deletions images/airflow/2.10.3/bootstrap/01-root-firstpass/001-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,46 @@
set -e

dnf update -y

# shellcheck source=images/airflow/2.10.3/bootstrap/common.sh
source /bootstrap/common.sh

verify_env_vars_exist \
BUILDARCH \
TINI_DOWNLOAD_BASE_URL \
TINI_ARM_SUFFIX \
TINI_X86_SUFFIX \
TINI_ARM_SHA_CHECKSUM \
TINI_X86_SHA_CHECKSUM

dnf install -y wget

# Create directory for tini
mkdir -p /usr/local/bin

if [ "${BUILDARCH}" == "amd64" ]; then
TINI_BINARY="${TINI_X86_SUFFIX}"
TINI_SHA_CHECKSUM="${TINI_X86_SHA_CHECKSUM}"
elif [ "${BUILDARCH}" == "arm64" ]; then
TINI_BINARY="${TINI_ARM_SUFFIX}"
TINI_SHA_CHECKSUM="${TINI_ARM_SHA_CHECKSUM}"
else
echo "Unsupported architecture: ${ARCH}"
exit 1
fi

# Download tini binary
mkdir tini_source
wget "${TINI_DOWNLOAD_BASE_URL}${TINI_BINARY}" -P /tini_source

# Verify checksum
echo "${TINI_SHA_CHECKSUM} /tini_source/${TINI_BINARY}" | sha256sum --check - | grep --basic-regex "^/tini_source/${TINI_BINARY}: OK$"
cp "/tini_source/${TINI_BINARY}" "/usr/local/bin/tini"

# Make tini executable
chmod +x /usr/local/bin/tini

# Clean up
rm -rf /tini_source

dnf remove -y wget
6 changes: 6 additions & 0 deletions images/airflow/2.9.2/Dockerfile.base.j2
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ ARG MARIADB_RPM_DEVEL_ARM_CHECKSUM=a49c1402378581ba2d63d97daa4a4c04
ARG MARIADB_RPM_SHARED_PREFIX=MariaDB-shared-11.4.3-1.fc38
ARG MARIADB_RPM_SHARED_X86_CHECKSUM=26a6c7fb021c09b85c21ec1878c1953f
ARG MARIADB_RPM_SHARED_ARM_CHECKSUM=fd2ce395bf7d2cb959495bbd02ffec2e
ARG TINI_DOWNLOAD_BASE_URL=https://github.com/krallin/tini/releases/download/v0.19.0/
ARG TINI_X86_SUFFIX=tini
ARG TINI_ARM_SUFFIX=tini-arm64
ARG TINI_ARM_SHA_CHECKSUM=07952557df20bfd2a95f9bef198b445e006171969499a1d361bd9e6f8e5e0e81
ARG TINI_X86_SHA_CHECKSUM=93dcc18adc78c65a028a84799ecf8ad40c936fdfc5f2a57b1acda5a8117fa82c


ENV AIRFLOW_CONSTRAINTS_FILE=${AIRFLOW_USER_LOCAL_ETC_PATH}/airflow_constraints.txt
ENV MWAA_ESSENTIAL_CONSTRAINTS_FILE=${AIRFLOW_USER_LOCAL_ETC_PATH}/mwaa_essential_constraints.txt
Expand Down
6 changes: 3 additions & 3 deletions images/airflow/2.9.2/Dockerfile.derivatives.j2
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ RUN rm -rf /bootstrap-dev
{# This is the standard build type. it is what customer uses.#}
USER airflow

ENTRYPOINT ["python3", "-m", "mwaa.entrypoint"]
ENTRYPOINT ["/usr/local/bin/tini", "--", "python3", "-m", "mwaa.entrypoint"]

CMD shell
{% elif build_type == 'explorer' %}
Expand All @@ -42,7 +42,7 @@ require further setup.
#}
USER airflow

ENTRYPOINT ["/bin/bash"]
ENTRYPOINT ["/usr/local/bin/tini", "--", "/bin/bash"]
{% elif build_type == 'explorer-privileged' %}
{#
This is similar to the 'explorer' build type, but additionally uses the root
Expand All @@ -51,7 +51,7 @@ thus, install packages, remove packages, or anything else.
#}
USER root

ENTRYPOINT ["/bin/bash"]
ENTRYPOINT ["/usr/local/bin/tini", "--", "/bin/bash"]
{% else %}
{{ raise("Invalid build type.") }}
{% endif %}
2 changes: 1 addition & 1 deletion images/airflow/2.9.2/Dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ FROM amazon-mwaa-docker-images/airflow:2.9.2-base

USER airflow

ENTRYPOINT ["python3", "-m", "mwaa.entrypoint"]
ENTRYPOINT ["/usr/local/bin/tini", "--", "python3", "-m", "mwaa.entrypoint"]

CMD shell
2 changes: 1 addition & 1 deletion images/airflow/2.9.2/Dockerfiles/Dockerfile-dev
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ RUN rm -rf /bootstrap-dev

USER airflow

ENTRYPOINT ["python3", "-m", "mwaa.entrypoint"]
ENTRYPOINT ["/usr/local/bin/tini", "--", "python3", "-m", "mwaa.entrypoint"]

CMD shell
2 changes: 1 addition & 1 deletion images/airflow/2.9.2/Dockerfiles/Dockerfile-explorer
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ FROM amazon-mwaa-docker-images/airflow:2.9.2-base

USER airflow

ENTRYPOINT ["/bin/bash"]
ENTRYPOINT ["/usr/local/bin/tini", "--", "/bin/bash"]
2 changes: 1 addition & 1 deletion images/airflow/2.9.2/Dockerfiles/Dockerfile-explorer-dev
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ RUN rm -rf /bootstrap-dev

USER airflow

ENTRYPOINT ["/bin/bash"]
ENTRYPOINT ["/usr/local/bin/tini", "--", "/bin/bash"]
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ FROM amazon-mwaa-docker-images/airflow:2.9.2-base

USER root

ENTRYPOINT ["/bin/bash"]
ENTRYPOINT ["/usr/local/bin/tini", "--", "/bin/bash"]
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ RUN rm -rf /bootstrap-dev

USER root

ENTRYPOINT ["/bin/bash"]
ENTRYPOINT ["/usr/local/bin/tini", "--", "/bin/bash"]
5 changes: 5 additions & 0 deletions images/airflow/2.9.2/Dockerfiles/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ ARG MARIADB_RPM_DEVEL_ARM_CHECKSUM=a49c1402378581ba2d63d97daa4a4c04
ARG MARIADB_RPM_SHARED_PREFIX=MariaDB-shared-11.4.3-1.fc38
ARG MARIADB_RPM_SHARED_X86_CHECKSUM=26a6c7fb021c09b85c21ec1878c1953f
ARG MARIADB_RPM_SHARED_ARM_CHECKSUM=fd2ce395bf7d2cb959495bbd02ffec2e
ARG TINI_DOWNLOAD_BASE_URL=https://github.com/krallin/tini/releases/download/v0.19.0/
ARG TINI_X86_SUFFIX=tini
ARG TINI_ARM_SUFFIX=tini-arm64
ARG TINI_ARM_SHA_CHECKSUM=07952557df20bfd2a95f9bef198b445e006171969499a1d361bd9e6f8e5e0e81
ARG TINI_X86_SHA_CHECKSUM=93dcc18adc78c65a028a84799ecf8ad40c936fdfc5f2a57b1acda5a8117fa82c

ENV AIRFLOW_CONSTRAINTS_FILE=${AIRFLOW_USER_LOCAL_ETC_PATH}/airflow_constraints.txt
ENV MWAA_ESSENTIAL_CONSTRAINTS_FILE=${AIRFLOW_USER_LOCAL_ETC_PATH}/mwaa_essential_constraints.txt
Expand Down
Loading

0 comments on commit c5e49ab

Please sign in to comment.