Closed fl034 closed 1 year ago
You save time having to nom install unless dependencies have changed. This then saves time hence why it's split the way it's split.
Thx! Answered in one minute. You're faster than any paid support 🚀
Okay the workflow then is to change package.json during development and run docker compose up --build
, right?
But shouldn't then the package-lock.json
be updated in my git repository so I can commit it?
If you are changing package.json then you want to use --build
indeed to rebuild the image.
If package.json
hasn't change then package-lock.json
won't change either.
So we copy both over then npm install. I guess we could also use npm ci
too if you need to keep strict versions etc.
Yeah so I changed package.json
, ran --build
, packages were installed correctly, all good.
But the package-lock.json
which is updated inside the container directory /opt/app
is not being synced back to the repository.
IMHO: Would be cool to have for the non-production Dockerfile
It should not be synced back. Docker creates an image and state, If your using compose you can bind the file just as much as you bind package.json
🤷♀️ What did you do
I'm coming from a Strapi v3 project, so there my workflow in development phase was to install dependencies inside my running docker container via
npm install ...
. Then my package.json+ lock file would be updated and I could commit it.With this dockerized approach the file won't change in my git repository.
Am I supposed to change the package.json file by hand and then run RESET with dockerize?
If yes, what are the benefits of this approach?
👩💻 Environment