You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2021/08/02 13:43:57 UTC
[airflow] 02/22: Fixes UI assets compilation from PROD image built
from sources (#17086)
This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch v2-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
commit 08c8473d589203aa9a895985b274ad686cce7f06
Author: Jarek Potiuk <ja...@potiuk.com>
AuthorDate: Mon Jul 19 19:52:15 2021 +0200
Fixes UI assets compilation from PROD image built from sources (#17086)
The #16577 change removed yarn.lock from installed packages
and it removed the possibility of preparing assets after the
package is installed - so far that was the way it was done in
the PROD image built from sources. The asset compilation
was supposed to work after the change but it was not
performed in this case.
The change fixes it by:
* detecting properly if the PROD image is built from sources
(INSTALLATION_METHOD)
* compiling the assets from sources, not from package
* installing airflow from sources AFTER assets were compiled
Fixes #16939
(cherry picked from commit 660027f65d5333368aad7f16d3c927b9615e60ac)
---
Dockerfile | 11 ++++++-----
scripts/docker/compile_www_assets.sh | 7 ++++++-
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/Dockerfile b/Dockerfile
index 8c32913..66c9649 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -248,15 +248,16 @@ ENV ADDITIONAL_PYTHON_DEPS=${ADDITIONAL_PYTHON_DEPS} \
WORKDIR /opt/airflow
# hadolint ignore=SC2086, SC2010
-RUN if [[ ${INSTALL_FROM_DOCKER_CONTEXT_FILES} == "true" ]]; then \
- bash /scripts/docker/install_from_docker_context_files.sh; \
- elif [[ ${INSTALL_FROM_PYPI} == "true" ]]; then \
- bash /scripts/docker/install_airflow.sh; \
- else \
+RUN if [[ ${AIRFLOW_INSTALLATION_METHOD} == "." ]]; then \
# only compile assets if the prod image is build from sources
# otherwise they are already compiled-in
bash /scripts/docker/compile_www_assets.sh; \
fi; \
+ if [[ ${INSTALL_FROM_DOCKER_CONTEXT_FILES} == "true" ]]; then \
+ bash /scripts/docker/install_from_docker_context_files.sh; \
+ elif [[ ${INSTALL_FROM_PYPI} == "true" ]]; then \
+ bash /scripts/docker/install_airflow.sh; \
+ fi; \
if [[ -n "${ADDITIONAL_PYTHON_DEPS}" ]]; then \
bash /scripts/docker/install_additional_dependencies.sh; \
fi; \
diff --git a/scripts/docker/compile_www_assets.sh b/scripts/docker/compile_www_assets.sh
index 01c5470..59a7017 100755
--- a/scripts/docker/compile_www_assets.sh
+++ b/scripts/docker/compile_www_assets.sh
@@ -28,7 +28,12 @@ function compile_www_assets() {
md5sum_file="static/dist/sum.md5"
readonly md5sum_file
local www_dir
- www_dir="$(python -m site --user-site)/airflow/www"
+ if [[ ${AIRFLOW_INSTALLATION_METHOD=} == "." ]]; then
+ # In case we are building from sources in production image, we should build the assets
+ www_dir="${AIRFLOW_SOURCES_TO}/airflow/www"
+ else
+ www_dir="$(python -m site --user-site)/airflow/www"
+ fi
pushd ${www_dir} || exit 1
yarn install --frozen-lockfile --no-cache
yarn run prod