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

Verify static files in docker container #22061

Closed
wants to merge 1 commit into from
Closed

Verify static files in docker container #22061

wants to merge 1 commit into from

Conversation

KevinMind
Copy link
Contributor

Relates to: mozilla/addons#2000

Description

This PR introduces checks for static files in our docker container. I achieve this with 3 changes:

  • extracting the logic for copying static assets from node_modules into a shell script
  • adding a check in the shell script to verify the assets are in the correct location in the file system
  • allowing the script to execute in a --check-only mode (useful for CI) where we rely on the docker build to copy and only use the check to verify the work
  • setting the NODE_PATH environment variable in the docker build so it can be sed across makefile scripts and executables.

Context

The script expects the NODE_PATH environment variable to be set so if you run outside a docker container, you have to set it and likely you don't have the correct node_modules installed so it should ideally only be run via the make command.

Testing

You can run the command locally via

make update_assets

to copy files and

./scripts/copy_node_assets.sh --check-only

to verify the assets.

@KevinMind KevinMind marked this pull request as draft March 22, 2024 10:09
@KevinMind KevinMind force-pushed the ADDSRV-775 branch 3 times, most recently from 8d8c641 to 55ebcb6 Compare March 25, 2024 10:17
@KevinMind KevinMind force-pushed the ADDSRV-775 branch 2 times, most recently from 19101a0 to 8049f44 Compare March 25, 2024 11:55
@KevinMind
Copy link
Contributor Author

This is totally unnecessary as the docker build actually fails when there are any missing but expected npm static file dependencies.

the compress_assets command imports specific files declared in our MINIFY_BUNDLES map, if any file is missing, it will raise a not found error.

@KevinMind KevinMind closed this Mar 25, 2024
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.

1 participant