Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AIRFLOW-3906] Add npm compile to docker file #4724

Merged
merged 8 commits into from
Feb 28, 2019

Conversation

ffinfo
Copy link
Contributor

@ffinfo ffinfo commented Feb 17, 2019

Make sure you have checked all steps below.

Jira

Description

Adding nom, compile step to Dockerfile

Tests

  • My PR adds the following unit tests OR does not need testing for this extremely good reason:

Commits

  • My commits all reference Jira issues in their subject lines, and I have squashed multiple commits if they address the same issue. In addition, my commits follow the guidelines from "How to write a good git commit message":
    1. Subject is separated from body by a blank line
    2. Subject is limited to 50 characters (not including Jira issue reference)
    3. Subject does not end with a period
    4. Subject uses the imperative mood ("add", not "adding")
    5. Body wraps at 72 characters
    6. Body explains "what" and "why", not "how"

Documentation

  • In case of new functionality, my PR adds documentation that describes how to use it.
    • When adding new operators/hooks/sensors, the autoclass documentation generation needs to be added.

Code Quality

  • Passes flake8

@ffinfo ffinfo changed the title [AIRFLOW-3906] Added compile step for npm packages [AIRFLOW-3906] Add npm compile to docker file Feb 17, 2019
@codecov-io
Copy link

codecov-io commented Feb 17, 2019

Codecov Report

Merging #4724 into master will increase coverage by 0.15%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4724      +/-   ##
==========================================
+ Coverage   74.29%   74.44%   +0.15%     
==========================================
  Files         450      450              
  Lines       28970    28970              
==========================================
+ Hits        21522    21567      +45     
+ Misses       7448     7403      -45
Impacted Files Coverage Δ
airflow/www/views.py 76.27% <0%> (+0.21%) ⬆️
airflow/bin/cli.py 67.22% <0%> (+0.41%) ⬆️
airflow/www/app.py 97.32% <0%> (+0.89%) ⬆️
airflow/operators/docker_operator.py 97.7% <0%> (+1.14%) ⬆️
airflow/contrib/hooks/gcp_dataflow_hook.py 75.75% <0%> (+1.21%) ⬆️
airflow/task/task_runner/base_task_runner.py 79.31% <0%> (+1.72%) ⬆️
airflow/hooks/dbapi_hook.py 79.03% <0%> (+2.41%) ⬆️
airflow/_vendor/slugify/slugify.py 60.63% <0%> (+4.25%) ⬆️
airflow/contrib/hooks/pinot_hook.py 82.5% <0%> (+5%) ⬆️
airflow/hooks/hdfs_hook.py 92.5% <0%> (+60%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 71140dd...02d1dea. Read the comment docs.

@Fokko
Copy link
Contributor

Fokko commented Feb 17, 2019

@verdan PTAL

Dockerfile Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved
@jmcarp
Copy link
Contributor

jmcarp commented Feb 18, 2019

Do we want to add the node runtime to the image, or just the compiled assets? If just the assets, this might be a good use case for multi-stage builds.

Dockerfile Outdated Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved
@Fokko
Copy link
Contributor

Fokko commented Feb 19, 2019

@ffinfo can you pick up @BasPH his comments so we can get this in? Having a UI makes testing a lot easier.

@jmcarp Good point, maybe create a ticket for multistage Docker builds? There is also a multi-layered version here: #4543

@ffinfo
Copy link
Contributor Author

ffinfo commented Feb 21, 2019

Dockerfile Outdated Show resolved Hide resolved
Copy link
Member

@zhongjiajie zhongjiajie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we set env in L19 rather than L55?

Dockerfile Outdated Show resolved Hide resolved

WORKDIR /opt/airflow/airflow/www
RUN npm install \
&& npm run prod
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-1 to doing it this way: Having Node and all of the node_modules in the final image isn't great.

Instead we should use a multi-stage docker file so this line becomes:

COPY --from=assert-builder /opt/airflow/airflow/www/static/dist /opt/airflow/airflow/www/static/dist

And then earlier in the docker file we have (i.e. right at the start)

FROM node as asset-builder
COPY ./airflow/www/package*json /opt/airflow/airflow/www/package.json
RUN npm install
COPY ./airflow/www/static/ /opt/airflow/airflow/www/static/
RUN npm run prod

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as @jmcarp said in #4724 (comment)

Copy link
Contributor

@Fokko Fokko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ffinfo for picking this up.

To avoid a scope creep, I'll merge this one, and I've created a new ticket for turning this into a multi stage build: https://issues.apache.org/jira/browse/AIRFLOW-3976

I would like merge this so I have a working UI again.

@Fokko Fokko merged commit 04e6301 into apache:master Feb 28, 2019
andriisoldatenko pushed a commit to andriisoldatenko/airflow that referenced this pull request Jul 26, 2019
wmorris75 pushed a commit to modmed/incubator-airflow that referenced this pull request Jul 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants