DEV Community

t.okazaki
t.okazaki

Posted on

3 1

AWS Codebuild: Prepare your own custom build environment

AWS Codebuild is a fully managed continuous integration service that compiles source code, runs tests, and produces software packages that are ready to deploy.You can create custom build environments that use your own build tools.

This feature caught my attention because I am a little bothered that existing fully managed CI service has changed their build environment and our development team took a time to repair the build script.
( Of ourse, you can also get started quickly by using prepackaged build environments on Codebuild )

How to prepare your own custom build environment

We have to prepare a Docker image for custom build environment. Hopefully, AWS give us sample docker images. You can get them by following.

$ git clone https://github.com/aws/aws-codebuild-docker-images.git
$ cd aws-codebuild-docker-images
$ cd ubuntu/standard/4.0
$ docker build -t aws/codebuild/standard:4.0 .
$ ls -1
Dockerfile
amazon-ssm-agent.json
dockerd-entrypoint.sh
legal
runtimes.yml
ssh_config
tools

$ docker run -it --entrypoint sh aws/codebuild/standard:4.0 -c bash
Enter fullscreen mode Exit fullscreen mode

In the Dockerfile, various programming language packages, browsers and another build tools are installed
For example:

  • ChromeDriver, Chrome, Firefox
  • Java, Ruby, Python, PHP, Golang, Nodejs

You can add or choose packages which you need by customising above Dockerfile.

Local debugging your custom build environment

You can run Codebuild on your laptop using Docker. You can test and build your custom Codebuild docker image and your application locally before committing.

Pull the docker image of the local CodeBuild agent.

docker pull amazon/aws-codebuild-local:latest --disable-content-trust=false
Enter fullscreen mode Exit fullscreen mode

Download the shell script named codebuild_build.sh from AWS GIthub
https://github.com/aws/aws-codebuild-docker-images/tree/master/local_builds

./codebuild_build.sh -i codebuild4-test:1.0 -a /tmp -s /work/repo -m
Enter fullscreen mode Exit fullscreen mode

options

  • -i Specify docker image tag of your custom build environment image.
  • -a Used to specify an artifact output directory.
  • -s Used to specify a source directory. Defaults to the current working directory.
  • -m Used to mount the source directory to the customer build container directly.
  • -c Use the AWS configuration and credentials from your local host. This includes ~/.aws and any AWS_* environment variables.

References

Playwright CLI Flags Tutorial

5 Playwright CLI Flags That Will Transform Your Testing Workflow

  • --last-failed: Zero in on just the tests that failed in your previous run
  • --only-changed: Test only the spec files you've modified in git
  • --repeat-each: Run tests multiple times to catch flaky behavior before it reaches production
  • --forbid-only: Prevent accidental test.only commits from breaking your CI pipeline
  • --ui --headed --workers 1: Debug visually with browser windows and sequential test execution

Learn how these powerful command-line options can save you time, strengthen your test suite, and streamline your Playwright testing experience. Practical examples included!

Watch Video 📹️

Top comments (0)

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, valued within the supportive DEV Community. Coders of every background are welcome to join in and add to our collective wisdom.

A sincere "thank you" often brightens someone’s day. Share your gratitude in the comments below!

On DEV, the act of sharing knowledge eases our journey and fortifies our community ties. Found value in this? A quick thank you to the author can make a significant impact.

Okay