DocsLifecycle schemaGitHub Service

GitHub Service

Build and deploy Services from GitHub repositories with Docker.

The github Service type builds and deploys applications from a GitHub repository with a Dockerfile. Use this Service type for application code that Lifecycle must build from source.

Examples

Minimal configuration with only required fields:

Docker configuration

The docker section defines how Lifecycle builds and runs the application.

docker.defaultTag

The default Docker image tag, typically matching the branch name.

docker.builder

Configuration for the Docker build operation.

FieldTypeDescription
enginestringBuild engine: buildkit, kaniko, or ci
resources.requestsobjectMinimum CPU/memory guaranteed for the build job
resources.limitsobjectMaximum CPU/memory allowed for the build job
podAnnotationsRecord<string,string>Custom annotations applied to the build pod template

The resources field configures CPU and memory for the build Job container. Use standard Kubernetes resource units. For example, use "500m" for CPU and "1Gi" for memory.

Service resource values replace the installation defaults. If you need a specific build engine, set engine explicitly. For engine: ci, also set docker.pipelineId to the Codefresh image-build pipeline.

Each build pod automatically has the annotation cluster-autoscaler.kubernetes.io/safe-to-evict: "false" to prevent the Kubernetes cluster autoscaler from evicting long-running build jobs during scale-down. The podAnnotations field adds Service annotations. It cannot override the safe-to-evict value.

EngineDefault CPU requestDefault memory requestDefault CPU limitDefault memory limit
buildkit500m1Gi24Gi
kaniko300m750Mi12Gi

docker.app (required)

Configuration for the main application container:

  • dockerfilePath - Required. Path to Dockerfile relative to repo root
  • command - Override container entrypoint
  • arguments - Arguments passed to the command. Use %%SPLIT%% to delimit spaces, for example, -c%%SPLIT%%npm run start.
  • env - Environment variables
  • ports - Exposed container ports

Optional Docker-level fields:

FieldDescription
pipelineIdCodefresh image-build pipeline used by engine: ci
ecrRegistry identifier override used for the built image

docker.app.afterBuildPipelineConfig can configure a follow-up Codefresh pipeline:

FieldDescription
afterBuildPipelineIdPipeline to run after an image build succeeds
descriptionHuman-readable pipeline description
detatchAfterBuildPipelineLegacy misspelled compatibility field
⚠️

detatchAfterBuildPipeline is the accepted spelling. Use it only with an existing configuration that needs this behavior. Do not add it to a new configuration.

docker.init (optional)

Configuration for an init container that runs before the primary application container. The init container has the fields from docker.app.

Deployment options

The deployment section configures how Lifecycle deploys the Service to Kubernetes. All fields are optional.

public

The public field controls ingress exposure.

  • true - Lifecycle creates an ingress and a public URL.
  • false - Users can access the Service only in the cluster.

capacityType

Specifies the node capacity type for scheduling:

  • SPOT - Prefer spot instances. This is the default.
  • ON_DEMAND - Use only on-demand instances.

SPOT adds a preferred spot-node affinity. Kubernetes can select on-demand capacity when spot capacity is unavailable. ON_DEMAND adds a mandatory on-demand affinity.

⚠️

Use SPOT or ON_DEMAND. Other spellings can prevent workload scheduling.

resource

CPU and memory requests and limits for the container:

FieldDescription
cpu.requestMinimum CPU guaranteed, for example, 100m
cpu.limitMaximum CPU allowed, for example, 1000m
memory.requestMinimum memory guaranteed, for example, 256Mi
memory.limitMaximum memory allowed, for example, 1Gi

readiness

A health check tells Lifecycle when the Service is ready to receive traffic.

HTTP health check:

FieldDescription
httpGet.pathHTTP endpoint path, for example, /health
httpGet.portPort to check

TCP health check:

FieldDescription
disabledDisable the generated readiness probe
tcpSocketPortTCP port to check connectivity

Shared fields:

FieldDescription
initialDelaySecondsDelay before first check
periodSecondsInterval between checks
timeoutSecondsTimeout for each check
successThresholdConsecutive successes to be healthy
failureThresholdConsecutive failures to be unhealthy

hostnames

Custom hostname configuration. If hostnames is missing, Lifecycle generates the hostnames.

FieldDescription
hostCustom hostname suffix
defaultInternalHostnameInternal Kubernetes hostname
defaultPublicUrlDefault public URL
acmARNAWS ACM certificate ARN for TLS

network

Advanced network configuration:

FieldDescription
ipWhitelistArray of allowed IP ranges (CIDR notation)
pathPortMappingMap URL paths to container ports
hostPortMappingMap hostnames to container ports
grpc.enableEnable gRPC support
grpc.hostgRPC hostname
grpc.defaultHostDefault gRPC hostname fallback

serviceDisks

Persistent volume mounts for stateful data:

FieldRequiredDescription
nameYesVolume name
mountPathYesContainer path
storageSizeYesStorage size, for example, 10Gi
accessModesNoReadWriteOnce, ReadOnlyMany, ReadWriteMany, or ReadWriteOncePod
mediumNoStorage medium

Node placement

Use deployment.node_selector for simple Kubernetes node-label matches and deployment.node_affinity for a full Kubernetes nodeAffinity object. Custom node affinity replaces Lifecycle’s capacity-type affinity.

Field reference

Required fields

FieldTypeDescription
repositorystringGitHub repository in owner/repo format
branchNamestringBranch to build from
dockerobjectDocker build configuration (see above)

Optional fields

FieldTypeDescription
deploymentobjectDeployment configuration (see above)
envLensbooleanEnable the Environment Lens ingress banner

Template variables

Use template variables to reference other Services in your configuration. See Template variables for the full list.