nx-tools icon indicating copy to clipboard operation
nx-tools copied to clipboard

Feature Request(nx-docker): Default Docker Files

Open wSedlacek opened this issue 4 years ago • 3 comments

As it stands a docker file is needed for each project that a user wishes to Dockerize. I believe that nx-docker is in a position to provide a default Dockerfile that installs from either the root package.json or a provided one and runs the production build commands.

Of course a custom Dockerfile should be allowed however for common applications like NestJS, Angular, Node, React, etc. it may not be necessary to require a user of this library to provide one. Perhaps we can look at the builder for the build command and determine what preset to use as nwrl uses different builders for each of these projects.

This feature would also make it much easier for those who use Nwrl Nx to get into dockerizing applications without any prior knowledge of Docker.

wSedlacek avatar Aug 31 '20 17:08 wSedlacek

That would be really great. I'm currently struggeling to find out why docker is not able to pick up the files that I build with nx before. And example would also already be very very helpful, because although I'm used to creating Dockerfiles for me there is this blank spot in connecting nx build with docker and how putting the dist into it really should look like.

DaSchTour avatar May 04 '21 08:05 DaSchTour

Any news on this? I have no idea how to create a Dockerfile that will be used by nx-docker.

jacqueslareau avatar Aug 10 '21 20:08 jacqueslareau

There's is nothing special about Dockerfiles for nx-docker, it's just a normal Dockerfile.

Please check this repository https://github.com/gperdomor/nx-docker-sandbox, every app has is own Dockerfile according the type of app, also check the docker target of each app in their corresponding project.json

gperdomor avatar Aug 10 '21 20:08 gperdomor

This is handled in init generator of @nx-tools/nx-container plugin...

gperdomor avatar Nov 15 '22 11:11 gperdomor