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

Move npm install outside of Docker #1328

Merged
merged 8 commits into from
Mar 14, 2022
Merged

Move npm install outside of Docker #1328

merged 8 commits into from
Mar 14, 2022

Conversation

megahirt
Copy link
Collaborator

@megahirt megahirt commented Mar 13, 2022

Description

This changes the build to require node on the developer's machine and moves the npm install step outside docker (to take advantage of npm caching). This should result in faster Docker builds on the developer's machine and possibly also on GHA (due to node_module caching on GHA)

Additional notes:

  • I needed to rebuild node-sass in Docker since the Docker environment is likely different than the developer host machine
  • I removed the npm run build:dev from the test-e2e Dockerfile because I discovered it's not needed

Important Note to Developers

This changes the build in a significant way. Once this PR is merged, the developer machine must have the appropriate version of node and npm installed locally. Use Node 14.16.1 and npm 7.6.3

Fixes #1323

Type of Change

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist

  • I have performed a self-review of my own code
  • I have reviewed the title/description of this PR which will be used as the squashed PR commit message
  • I have commented my code, particularly in hard-to-understand areas

- moved style guide lower in developer.md

- moved section on branch workflow to contributing.md
Remove the npm-cache docker image
optimize the composer install step - should not be coupled with apt install
renamed tests.yml to pull_request.yml

In addition to running tests, we should also build the app and ensure it builds :)
This changes the build to require node on the developer's machine and moves the npm install outside docker (to take advantage of npm caching)

Additional notes:
- I needed to rebuild node-sass in Docker since the Docker environment is likely different than the developer host machine
- I removed the npm run build:dev from test-e2e because I discovered it's not needed
@github-actions
Copy link

github-actions bot commented Mar 13, 2022

Unit Test Results

    1 files      1 suites   8s ⏱️
373 tests 373 ✔️ 0 💤 0

Results for commit 7435375.

♻️ This comment has been updated with latest results.

Add the npm install step to both the build-and-publish-adhoc.yml and integrate-and-deploy.yml files
Copy link
Collaborator

@rmunn rmunn left a comment

Choose a reason for hiding this comment

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

Would like to discuss a couple of these items (specifically, the Node version and whether node_modules can be volume-mounted) before merging, but I'm okay with this being merged as-is if necessary.

docker/app/Dockerfile Show resolved Hide resolved
.github/workflows/build-and-publish-adhoc.yml Show resolved Hide resolved
.github/workflows/build-and-publish-adhoc.yml Show resolved Hide resolved
docker/test-e2e/Dockerfile Show resolved Hide resolved
Copy link
Collaborator Author

@megahirt megahirt left a comment

Choose a reason for hiding this comment

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

Thanks for the review, Robin!

.github/workflows/build-and-publish-adhoc.yml Show resolved Hide resolved
.github/workflows/build-and-publish-adhoc.yml Show resolved Hide resolved
docker/app/Dockerfile Show resolved Hide resolved
docker/test-e2e/Dockerfile Show resolved Hide resolved
@megahirt megahirt merged commit 180e28b into develop Mar 14, 2022
@megahirt megahirt deleted the chore/noNpmInDocker branch March 14, 2022 03:38
Copy link
Contributor

@longrunningprocess longrunningprocess left a comment

Choose a reason for hiding this comment

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

great work @megahirt , I'll trust you guys that the make and make dev still work from a "power-washed" env. I take it you had fun doing this 😊 future devs will never know how much faster things are now!

@megahirt
Copy link
Collaborator Author

@longrunningprocess I didn't actually test that scenario but will try that tomorrow. I assume it does since it is building on GHA ok.

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.

Refactor npm outside of Docker
3 participants