Dockerfile Starter for Any Language

A Dockerfile starter for running an app in any language as a container, with a small dependency-free Node.js 22 server inside as a working example. It is for developers who want to bring their own Dockerfile, and it includes a non-root image, clean shutdown and tests with the built-in Node.js test runner.

by Light CloudREST APIs

Features

  • A Dockerfile at the repository root that Light Cloud builds exactly as it is, on node:22-alpine
  • Example server on node:http with no npm packages: GET / returns a welcome message, version and endpoint list
  • GET /health returns {"status": "healthy"} with a timestamp and uptime in seconds; other paths get a JSON 404
  • The container runs as the image's unprivileged node user, not root
  • Handles SIGTERM and SIGINT: the server stops taking connections and lets open requests finish
  • .dockerignore keeps tests, .env files, the README and the logo out of the image
  • Tests run with node --test, with no package.json and no test framework to install

Tech stack

What you need

  • Free plan: it runs as a server app, and the Free plan includes 3 server apps
  • To run it locally: Docker, or Node.js 22 to run the example and its tests without Docker
  • No API keys: it starts with nothing to configure

About

The only contract is the port: whatever runs in the container must listen on 0.0.0.0 and the port in PORT, which the Dockerfile defaults to 8080. The Node.js example keeps the request handler in src/app.js apart from src/server.js, so tests can start it on a random port. The first change is usually replacing src/ and the Dockerfile with your own runtime, such as a python:3.12-slim or golang base image. Light Cloud builds the image and redeploys on each push to your copy, so Dockerfile edits go live with the next push, and the repo ships a .mcp.json for the Light Cloud MCP server.

FAQ

How do I deploy a Python, Go or Java app with a Dockerfile?

Replace src/ with your code and rewrite the Dockerfile for your runtime: a base image such as python:3.12-slim, your install and build steps, and a CMD that starts a server on 0.0.0.0 and the port in PORT.

Which port does my container need to listen on?

The one in the PORT environment variable. Light Cloud sets it, and the example falls back to 8080 when it is not set.

Why does a Node.js server in Docker need to handle SIGTERM?

The container runs node as process 1, which ignores SIGTERM unless the app handles it. src/server.js closes the server on SIGTERM so it exits cleanly instead of being killed.

How do I add npm dependencies to the example?

Add a package.json and lockfile, then in the Dockerfile copy them and run npm ci --omit=dev before COPY src ./src, so the install layer is cached between builds.

Can I run this Dockerfile on another host?

Yes. It has no Light Cloud code: build it with docker build, push the image to a registry and run it on any container host with PORT set.

Price
Free
Framework
Dockerfile · Docker
Plan
Free
Updated

Related templates

All rest api starters