Live data from Hacker News

Writing Dockerfiles for Node.js Web Apps

blog.hasura.io

1–10 of 37 posts

Re: Writing Dockerfiles for Node.js Web Apps

#2
Nice post, and very close to my experiences with Dockerfiles for node.

To the author: could you elaborate on the differences between carbon and alpine base images please? I can obviously go look this up, but this was the one part of the guide that was new to me. Your description wasn't enough to give me a complete understanding, so perhaps you could explain a bit more about carbon and alpine? Thanks.

Re: Writing Dockerfiles for Node.js Web Apps

#3
Ideally I'd like the same Dockerfile used for both local dev as well as deployment. To do this, we're using something similar to the first Dockerfile, with the `nodemon` install.

Then in a docker-compose.override.yml,

    command: nodemon --inspect=0.0.0.0:5858 /code/bin/www
To allow for debugging as well. We delete that .override.yml file as part of the CI build/deploy.

Re: Writing Dockerfiles for Node.js Web Apps

#5
When does it make sense to run Node on docker vs Heroku dynos or something similar? Is it just a cost thing at a certain number? Are these significantly specialized containers? The types mentioned in the doc seem like basic web apps.

I've used Docker for things like complicated java dev environments. But it seems over-applied for basic web apps.

Re: Writing Dockerfiles for Node.js Web Apps

#7

When does it make sense to run Node on docker vs Heroku dynos or something similar? Is it just a cost thing at a certain number? Are these significantly specialized containers? The types mentioned in the doc seem like basic web apps. I've used Docker for things like complicated java dev environments. But it seems over-applied for basic web apps.

I had the impression Heroku is generally more expensive.

Re: Writing Dockerfiles for Node.js Web Apps

#8
post #4

> Using an appropriate base image (carbon for dev, alpine for production). Isn't using the same container everywhere the actual selling point for containers?

you're right, plus docker-compose supports extending services in compose files. In the projects i dockerized, i have a docker-compose.yml, docker-compose.dev.yml, docker-compose.test.yml and docker-compose.prod.yml, no override files.

Re: Writing Dockerfiles for Node.js Web Apps

#9
post #2

Nice post, and very close to my experiences with Dockerfiles for node. To the author: could you elaborate on the differences between carbon and alpine base images please? I can obviously go look this up, but this was the one part of the guide that was new to me. Your description wasn't enough to give me a complete understanding, so perhaps you could explain a bit more about carbon and alpine? Thanks.

carbon is the latest LTS (Long Term Support) version of Node. Instead of using the latest version, which can have breaking changes and possible drop of support in the future, it is recommended to use LTS version just to ensure using a stable + well supported version. alpine base images are generally used to cut down the image size for production, because they are very minimal and works well for most use-cases. But you would generally use carbon or specific full blown version of node in development, because you can install system dependencies for bundling code.
Post reply on HN