DEV Community

loading...

Discussion on: Dockerize Create-React-App in 3 minutes

Collapse
ziv profile image
zivka Author

Try to map your ports to port 80 and to set your react app to expos it on port 80
CMD ["serve", "-p", "80", "-s", "."]

in your docker-compose
ports:
- "8000:80"

Collapse
pprathameshmore profile image
Prathamesh More

Now I am getting this error

 internal/modules/cjs/loader.js:969
scan-app-frontend |   throw err;
scan-app-frontend |   ^
scan-app-frontend |
scan-app-frontend | Error: Cannot find module '/use/src/app/serve'
scan-app-frontend |     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
scan-app-frontend |     at Function.Module._load (internal/modules/cjs/loader.js:842:27)
scan-app-frontend |     at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
scan-app-frontend |     at internal/main/run_main_module.js:17:47 {
scan-app-frontend |   code: 'MODULE_NOT_FOUND',
scan-app-frontend |   requireStack: []
scan-app-frontend | }
scan-app-frontend | internal/modules/cjs/loader.js:969
scan-app-frontend |   throw err;
Enter fullscreen mode Exit fullscreen mode
Thread Thread
pprathameshmore profile image
Prathamesh More

After installing serve as global

I getting this error

ERROR: for scan-app-frontend  Cannot start service react-app: network nanoheal_default not found
Enter fullscreen mode Exit fullscreen mode
Thread Thread
pprathameshmore profile image
Prathamesh More

Now image building well but not serving app

image

Thread Thread
ziv profile image
zivka Author

Make sure you install serve globally on your image. Take a look on my Dockerbuild file how do I install the serve