diff --git a/apps/nestjs-server/Dockerfile b/apps/nestjs-server/Dockerfile index 1a5ca8a..af6b97b 100644 --- a/apps/nestjs-server/Dockerfile +++ b/apps/nestjs-server/Dockerfile @@ -13,15 +13,12 @@ COPY --chown=node:node package.json . RUN mkdir -p apps/nestjs-server # copying only the required packages -COPY --chown=node:node ./apps/nestjs-server/package.json apps/nestjs-server COPY --chown=node:node ./apps/nestjs-server/tsconfig.*.json apps/nestjs-server +COPY --chown=node:node ./apps/nestjs-server/package.json apps/nestjs-server COPY --chown=node:node ./apps/nestjs-server apps/nestjs-server # install node_modules RUN yarn -# build nestjs-server -RUN yarn build - -# run server in dev env +# run server in prod env CMD ["yarn", "workspace", "nestjs-server", "start:prod"] diff --git a/apps/nestjs-server/src/main.ts b/apps/nestjs-server/src/main.ts index 373c015..976503a 100644 --- a/apps/nestjs-server/src/main.ts +++ b/apps/nestjs-server/src/main.ts @@ -13,6 +13,14 @@ async function bootstrap() { * the line below... */ // const app = await NestFactory.create(AppModule); + + /** + * Unfortunately NestJs prod build with fastify, works on local + * machine, but it does not port map on docker... + * + * Soln link - + * https://stackoverflow.com/questions/66086427/docker-container-with-nodejs-appnestjs-is-not-accessible-from-both-other-conta + */ const app = await NestFactory.create( AppModule, new FastifyAdapter({ @@ -20,7 +28,7 @@ async function bootstrap() { caseSensitive: false, }), ); - await app.listen(4000); + await app.listen(4000, '0.0.0.0'); } bootstrap();