Pick your framework and get a Dockerfile that builds small, runs as a non-root user where the framework allows it, and listens on 0.0.0.0 and the PORT your host sets. You also get a .dockerignore, a Procfile and the plain start command.
FROM node:24-slim WORKDIR /app ENV NODE_ENV=production COPY package.json package-lock.json ./ RUN npm ci --omit=dev COPY . . # Platforms set PORT; 3000 is the fallback for docker run. ENV PORT=3000 EXPOSE 3000 USER node # node directly, not npm start: npm would stay in memory and swallow SIGTERM. CMD ["node", "server.js"]
node server.jsconst port = Number(process.env.PORT) || 3000;
app.listen(port, "0.0.0.0", () => console.log(`Listening on ${port}`));EthioDeploy detects Node, Next.js, Python, PHP, Go and Ruby projects and builds them without one. If your repo has a Dockerfile, it builds that instead. Either way you get HTTPS, a database and deploys on every push. Free plan, no card.
Choose the runtime version and, for Node projects, the package manager your lockfile comes from. The lockfile must be committed.
Put the Dockerfile and .dockerignore in the project root, plus the Caddyfile for a Vite app. Use the Procfile instead on a buildpack host.
docker build -t app . then docker run -e PORT=8080 -p 8080:8080 app, and open localhost:8080. If it works there, it works on any host that sets PORT.
Last updated
Inside a container, 127.0.0.1 only accepts connections from the container itself. The platform's proxy connects from outside, so a server bound to localhost can't be reached and you get a 502. 0.0.0.0 means every interface.
It's the port the platform expects your app to listen on. Hosts set it at runtime and route traffic there, so read it from the environment instead of hard-coding 3000 or 8000.
No. A Procfile is for buildpack hosts like Heroku that build your app without Docker. With a Dockerfile, the CMD is the start command. Release lines in the Procfile, like migrations, become a pre-deploy command on Docker hosts.
Use the version you develop on. Node 24 is the current LTS line and Node 22 is still supported. Python 3.13 is a safe default; 3.14 works if your dependencies ship wheels for it.
Without output: "standalone", the image needs the whole node_modules. Standalone output traces only the files the server uses, and the generated Dockerfile copies just that folder plus static assets.
The Dockerfiles work on both, but an image built on an M-series Mac is arm64. If you build locally and push the image, add --platform linux/amd64 for an x86 server, or you'll see exec format error. Hosts that build from your repo build for their own CPU.
Read next: Docker exec format error from an Apple Silicon build · 502 Bad Gateway after deploy
EthioDeploy builds and runs your app on every push, with a database and HTTPS. Free plan, no card.
Deploy free