I created a REST API using NestJS and I want to deploy it to fly.io. fly.io requires me to create a Dockerfile
to do so. I don't know much about Dockerfile
s but fly.io has a cli tool that creates one for you.
I am not able to deploy my API, however, and my suspicion is that there's an issue with the Dockerfile
. Specifically, that the generated Dockerfile
isn't tailored specifically to a NESTJS app.
I am linking my repo below so you can view both the existing Dockerfile
and the structure of my API. Can someone please suggest how I can modify the Dockerfile
to work for a NESTJS app?
Thanks
https://github.com/AhmedAbbasDeveloper/noteify-server/tree/nestjs-migration
I think you need to expose a port that your nestjs server runs on. For your docker image you can set an env variable by adding
ENV PORT=8080
to yourDockerfile
and also need to expose it withEXPOSE 8080
. You can use any port, but since you've configured 8080 in fly, that makes more sense.