verdan commented on a change in pull request #4724: [AIRFLOW-3906] Add npm
compile to docker file
URL: https://github.com/apache/airflow/pull/4724#discussion_r258416549
##########
File path: Dockerfile
##########
@@ -16,26 +16,39 @@
FROM python:3.6-slim
-COPY . /opt/airflow/
-
ARG AIRFLOW_HOME=/usr/local/airflow
ARG AIRFLOW_DEPS="all"
ARG PYTHON_DEPS=""
ARG buildDeps="freetds-dev libkrb5-dev libsasl2-dev libssl-dev libffi-dev
libpq-dev git"
-ARG APT_DEPS="$buildDeps libsasl2-dev freetds-bin build-essential
default-libmysqlclient-dev apt-utils curl rsync netcat locales"
+ARG APT_DEPS="libsasl2-dev freetds-bin build-essential
default-libmysqlclient-dev apt-utils curl rsync netcat locales"
+
+ENV PATH="$HOME/.npm-packages/bin:$PATH"
+
+RUN if [ -n "${APT_DEPS}" ]; then apt install -y $APT_DEPS; fi \
+ && apt autoremove -yqq --purge \
+ && apt clean
+
+COPY . /opt/airflow/
WORKDIR /opt/airflow
RUN set -x \
&& apt update \
- && if [ -n "${APT_DEPS}" ]; then apt install -y $APT_DEPS; fi \
+ && if [ -n "${buildDeps}" ]; then apt install -y $buildDeps; fi \
+ && curl -sL https://deb.nodesource.com/setup_11.x | bash - \
+ && apt install -y nodejs \
&& if [ -n "${PYTHON_DEPS}" ]; then pip install --no-cache-dir
${PYTHON_DEPS}; fi \
+ && pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir --no-use-pep517 -e .[$AIRFLOW_DEPS] \
&& apt purge --auto-remove -yqq $buildDeps \
&& apt autoremove -yqq --purge \
- && apt clean
+ && apt clean \
+ && cd /opt/airflow/airflow/www \
+ && npm install \
+ && npm run prod
Review comment:
exactly, `npm run prod` command simply compiles all assets, minify them and
make them ready to be used using the flask server as static assets.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services