Quant Base Images
Quant publishes base images for Node.js and PHP applications. The Quant Cloud templates build on
them, and you can use them in your own Dockerfile. Both handle the headers that Quant’s edge adds
to each request, so your application sees the visitor’s host name and IP address.
Node.js: ghcr.io/quantcdn-templates/app-node
Section titled “Node.js: ghcr.io/quantcdn-templates/app-node”The image runs a small proxy in front of your application:
Quant edge -> container port 3000 (proxy) -> your app on 127.0.0.1:3001- The proxy listens on port 3000, which the container exposes. Your application must listen on
port 3001 (
QUANT_APP_PORT, set to 3001 in the image). SetENV PORT=3001and keepEXPOSE 3000. - The proxy copies the
Quant-Orig-Hostheader toHost, setsX-Forwarded-Prototohttpswhen it is missing, and setsX-Forwarded-For. - At start-up the image runs the executable scripts in
/quant-entrypoint.d/, starts the proxy, and then runs yourCMDas thenodeuser (UID 1000).
Proxy responses
Section titled “Proxy responses”| Response | Meaning |
|---|---|
503 Service Unavailable - App not ready |
Nothing accepts connections on port 3001: the application is still starting, has stopped, or listens on another port or address |
504 Gateway Timeout |
The application did not answer within the proxy timeout, 30 seconds by default (QUANT_PROXY_TIMEOUT, in milliseconds) |
502 Bad Gateway |
Another error while forwarding the request |
Each of these writes [quant-proxy] Error forwarding to app: <reason> to the container log. The
path /__quant_proxy_health is answered by the proxy itself, so it returns 200 even when your
application is down.
Next.js
Section titled “Next.js”The Next.js standalone server binds to the address in HOSTNAME. The container runtime can set
HOSTNAME to the container’s own host name, which overrides an ENV line in your Dockerfile. The
server then does not listen on the address the proxy uses, and every request gets the 503 above. Set
it when the process starts:
ENV PORT=3001EXPOSE 3000CMD ["sh", "-c", "HOSTNAME=0.0.0.0 exec node server.js"]Local development
Section titled “Local development”Set QUANT_PROXY_ENABLED=false and map port 3000 on your machine to 3001 in the container.
PHP: ghcr.io/quantcdn-templates/app-apache-php
Section titled “PHP: ghcr.io/quantcdn-templates/app-apache-php”- Apache with mod_php on port 80. Tags:
8.4(alsolatest),8.3,8.2and7.4(legacy). - Apache handles
Quant-Orig-Hostand takes the client IP fromQuant-Client-IP. www-datais remapped to UID/GID 1000, the owner of files on persistent volumes.- Apache and PHP log to stdout and stderr, so the output appears in the environment’s logs.
- Set
DOCUMENT_ROOTto change the document root (default/var/www/html), andPHP_*variables such asPHP_MEMORY_LIMIT(default256M) to change PHP limits. - Database connections use TLS by default. Set
DISABLE_DB_TLS=trueonly for a local database.
Your Own Image
Section titled “Your Own Image”Any image works on Quant Cloud. Make sure that it listens on the port you expose, writes its logs to stdout and stderr, and runs the process that writes to persistent volumes as UID 1000.
