Deploy stops at serving


I have a docker file that looks like this:

FROM node:14.15.0-alpine

WORKDIR /usr/src/app
COPY package*.json ./


COPY . ./

RUN npm run backend:build && npm run backend:serve


When I deploy it using fly --app construkt deploy it runs fine, then echoes the message that comes from my framework, about serving at, and then nothing. It hangs like that. What can I do?

Thanks in advance!

It seems your Dockerfile is missing a CMD or ENTRYPOINT. All the ones I’ve seen with node need one of those.

If that’s it, it may be as simple as adding this as the last line:

CMD ["node","app.js"]

(editing “app.js” of course to be your one e.g server .js or src/app.js, or index.js or whatever it is)

You can double-check your app is running and serving requests by adding a http healthcheck to your fly.toml. That will fail the deploy if the app is not serving requests, which can be handy. Take a look at:

1 Like

Hey hey, that was it! My Dockerfile was missing CMD. I run the app via, well, RUN command instead, hence the error. Thanks for a quick help, Greg!

1 Like

That run command is likely just hanging up the builder. It would be best to remove that from your Dockerfile if you haven’t already!