Page MenuHomePhabricator

SVGTranslate's Docker environment doesn't handle node/npm install
Closed, ResolvedPublic

Description

When changing any of the JS or CSS files, symfony expects to rebundle (apparently?) which means that we must run the
./node_modules/.bin/encore production command. But if this is run inside the current docker web shell, it doesn't recognize npm and doesn't have node_modules folder.

Sidebar: Is it possible to work with the JS files directly while debugging in symfony/webpack? It is very useful to add debugger statements, and webpack's bundling removes those anyways. Maybe we can find a good way to have that in the dev environment, or am I missing an already existing way?

Event Timeline

@Samwilson Is this ticket still required? Can we put it on the back-burner if it's not urgent anymore?

It's not urgent for me, but I think it's also not far from being done. I've brought the patch up to date with the latest feedback from @davidwbarratt, but the tests are currently failing due to some npm inconsistency — probably not too hard to fix, I'll look at it now and see if we can merge soon.

Samwilson moved this task from In Development to Ready on the Community-Tech-Sprint board.

So the tests are now failing on a different problem, and I can't figure it out. It looks to me like the commands for the two containers aren't being run (in Travis) on docker-compose up --build -d. Things work okay locally.

I'll leave this be for now until I think of something else to try. If anyone else wants to pick it up, go for it: https://github.com/wikimedia/svgtranslate/pull/48

This is being done at the same time as T223337.

Assets can now be built within the assets Docker image, e.g. docker-compose exec assets npm run assets