CLI build and docker


I couldn’t find anything related to this question, maybe I’m just misunderstanding.

If I must use the docker images to build my sites (different conflicting requirements), is that instead of ‘netlify build’ or do they work together? If I understand correctly, building with docker doesn’t use netlify.toml, so I would need to configure the commands manually? {edit} So the two tools can’t be used together?

best regards,

Hi Vlad,

You never have to use docker yourself! Our build system does it for you if we build from git. If you deploy with the CLI, you can build on your machine in the usual way (e.g. run npm run build on your source code), and our build system is never involved, nor is docker.

The only reason you’d use docker would be if you wanted to test a netlify build locally, rather than letting us run it for you (or if say you were developing a build plugin or trying to add a feature to our build system.)

Our docker build container run by you does ignore netlify.toml (in our CI, a different service parses that file and configures things). But in our CI, that config is parsed and used along with a build plugin.

Not sure I quite answered your question - let me know if not!

Thank you Chris,

I think I see what you mean. I have a site that I need to keep on PHP 7.2, while the others are on 7.4 and I wanted to build them locally with ‘netlify build’ with the right PHP version. The command uses whatever is the active version on my machine, so I thought I would use docker to do it right. I suppose it will be easier to use “normal” local methods like ‘update-alternatives’.

best regards,