Functions and Scaling Groups
Override a scaling group's container entrypoint, and serve gRPC instead of HTTP.
This page covers the command a scaling group’s replicas run, and the protocol its route forwards.
To override the image’s default entrypoint, pass entrypoint from the SDK or
--entrypoint from the CLI. These examples run Python’s built-in HTTP server on
the public python:3.12-slim image:
import chalkcompute
sg = chalkcompute.ScalingGroup(
image="python:3.12-slim",
name="custom-server",
port=8000,
entrypoint=["python", "-m", "http.server", "8000"],
).deploy()
$ chalk scaling-group create \
--image=python:3.12-slim \
--name=custom-server \
--max-replicas=1 \
--port=8000 \
--entrypoint="python,-m,http.server,8000"
The CLI takes comma-separated arguments; the SDK takes a list.
To serve gRPC instead of HTTP, set protocol="grpc" from the SDK or pass
--grpc from the CLI. The group’s route then forwards gRPC traffic to your
container’s port.