Let's say you have the following project:
.
├── Dockerfile
├── .dockerignore
├── nest-cli.json
├── package.json
├── package-lock.json
├── README.md
├── src
│ ├── app.controller.ts
│ ├── app.module.ts
│ ├── app.service.ts
│ └── main.ts
├── tsconfig.build.json
└── tsconfig.json
Make sure the main
entry of your package.json
points to the transpiled code like "main": "./dist/main.js"
You could use that Dockerfile
to build the image like this:
docker build . --tag "my-app:latest" --build-arg PORT=3000