Lightpress uses AWS CodeBuild as its CI/CD engine. CodeBuild readsDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/reds-skywalker/Lightpress/llms.txt
Use this file to discover all available pages before exploring further.
buildspec.yml from the repository root and executes a defined sequence of build phases — from installing dependencies through building Docker images to pushing artifacts and triggering deployments. Because CodeBuild is fully managed, you do not need to provision or maintain build servers.
How buildspec.yml works
When a build starts, CodeBuild clones your source repository, then reads buildspec.yml to determine what commands to run and in what order. The file is divided into named phases that execute sequentially. If any command in a phase exits with a non-zero status, CodeBuild marks the build as failed and stops execution.
A complete buildspec.yml for Lightpress follows this structure:
buildspec.yml
Build phases
Each phase has a specific responsibility in the pipeline:install — set up runtimes and dependencies
install — set up runtimes and dependencies
CodeBuild provisions a fresh build environment for every run. The
install phase declares the runtime versions to use (Node.js 18 and Python 3.11 for Lightpress) and installs project dependencies.Commands here run before any application code is executed. Keep this phase focused on dependency installation — npm ci, pip install, and similar commands.pre_build — lint, test, and authenticate
pre_build — lint, test, and authenticate
The A test failure here stops the build before any images are built or pushed, preventing a broken build from reaching production.
pre_build phase runs quality gates and prepares credentials before the main build. For Lightpress this includes running linters and tests against the client/ code, and authenticating the Docker daemon with Amazon ECR so it can push images in later phases.build — compile and build Docker images
build — compile and build Docker images
The
build phase compiles application code and produces Docker images for each Lightpress service. Images are tagged with $CODEBUILD_RESOLVED_SOURCE_VERSION — a unique identifier for the source commit — so every image is traceable back to the exact code that produced it.post_build — push images and deploy
post_build — push images and deploy
The
post_build phase pushes the built images to Amazon ECR and triggers a CloudFormation stack update to deploy the new version. This phase runs even if the build phase fails — use the CODEBUILD_BUILD_SUCCEEDING environment variable if you need to skip post-build steps on failure.Connecting a source repository
Open CodeBuild in the AWS console
Navigate to AWS CodeBuild in the AWS Management Console and choose Create build project.
Configure the source provider
Under Source, select your repository provider:
- GitHub — authorize with OAuth or a personal access token
- AWS CodeCommit — select the repository from the dropdown
- Bitbucket — authorize with OAuth
main).Set the environment
Choose a managed build image. For Lightpress, select:
- Operating system: Amazon Linux 2023
- Runtime: Standard
- Image:
aws/codebuild/standard:7.0(includes Node.js 18 and Python 3.11) - Privileged mode: enabled (required for building Docker images)
Point to buildspec.yml
Under Buildspec, select Use a buildspec file. CodeBuild will automatically read
buildspec.yml from the repository root. If your file is in a subdirectory, enter the relative path.Triggering builds
- Manual trigger
- Webhook trigger
- CodePipeline
Start a build from the console by choosing Start build on the project page, or from the CLI:
Viewing build logs
Build logs stream to Amazon CloudWatch Logs automatically. You can view them in real time from the CodeBuild console or from the CLI:Environment variables in CodeBuild
CodeBuild supports three types of environment variables, each suited to a different sensitivity level:| Type | Use for | How to set |
|---|---|---|
| Plaintext | Non-sensitive config like region names | Defined in buildspec.yml under env.variables or in the project settings |
| SSM Parameter Store | Credentials and tokens | Reference with parameter-store in buildspec.yml; CodeBuild fetches at build time |
| Secrets Manager | Rotating secrets and database passwords | Reference with secrets-manager in buildspec.yml |
buildspec.yml:
buildspec.yml
ssm:GetParameters permission for the referenced paths.
CodeBuild also injects several built-in environment variables you can use in your commands — for example,
$CODEBUILD_BUILD_ID, $CODEBUILD_RESOLVED_SOURCE_VERSION (the full commit SHA), and $CODEBUILD_BUILD_SUCCEEDING (set to 0 if any prior phase failed).