How can I containerize a monorepo react app that was built with nx

74 views Asked by At

I have a monorepo with one react app inside of it, so that I could learn how Nx works. There is no backend to this app. It is a simple todo react app.

The structure is as follows:

my-app (root)
├── .idea
├── dist
├── myreactapp
│   ├── .nx
│   └── dist
|   ├── e2e
│   └── src
|   ├── public
│   └── nx.json
└── yarn.lock
└── README.md
└── .gitignore

I am able to run

Nx Run

Nx Build

Nx Test

Nx Serve

all perfectly fine, app is working.

How can I create an image of this monorepo and the app within the monorepo using docker and run the image as a container? I want to be able to add projects to this monorepo in the future and also create new images and containers for the new apps as well.

Will I need Dockerfiles for both the root and for each project? Does having Nx chnage the way I need to write the Dockerfiles? Will I need some sort of compose or .yaml files as well?

I'm new to Docker and am really confused by the Nx project structure.

0

There are 0 answers