Skip to content

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). Set ENV PORT=3001 and keep EXPOSE 3000.
  • The proxy copies the Quant-Orig-Host header to Host, sets X-Forwarded-Proto to https when it is missing, and sets X-Forwarded-For.
  • At start-up the image runs the executable scripts in /quant-entrypoint.d/, starts the proxy, and then runs your CMD as the node user (UID 1000).
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.

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=3001
EXPOSE 3000
CMD ["sh", "-c", "HOSTNAME=0.0.0.0 exec node server.js"]

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 (also latest), 8.3, 8.2 and 7.4 (legacy).
  • Apache handles Quant-Orig-Host and takes the client IP from Quant-Client-IP.
  • www-data is 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_ROOT to change the document root (default /var/www/html), and PHP_* variables such as PHP_MEMORY_LIMIT (default 256M) to change PHP limits.
  • Database connections use TLS by default. Set DISABLE_DB_TLS=true only for a local database.

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.