Extending with Custom Build environments¶
Razorops majorly provides two types of build environments - Linux VM and Docker. For more details, please refer here.
Custom Build environments are Docker images that include a complete file system with everything required to build and test your project. With Docker based environment, we provide curated container images for most popular languages such as Java, Ruby, Python, Go, Node.js, etc. It can be extended through the use of custom build environments to support many more.
To use a custom build environment in a Razorops project, you build a container image for your platform that contains your build tools, push it to a Docker container registry, and reference it in the project configuration (.razorops.yaml
). When building your application, Razorops will retrieve the Docker image from the container registry specified and use the environment to execute the steps such as compile your source code, run your tests, and package your application.
Convenience Docker images¶
For convenience, Razorops comes with a repository of pre-built images hosted on Dockerhub and Razorops Container Registry (comming soon). The source code of the Docker images is hosted on Github. You can find the list of all convenience Docker images on our page.
These images contain various general purpose tools which your organization might not need. For the best experience, you can build your own container images optimized for building and testing your applications.
Building custom Docker images¶
Razorops Agents can use any public/private Docker image to run your jobs, if the following requirements are met:
The container is Linux based
bash >= 3.0
is installed in the imagegit >= 2.0
is installed in the imagecurl
is installed in the imageca-certificates
is installed in the imagecoreutils
is installed in the main imagetar
andgzip
To enable running Docker-in-Docker the docker
executable needs to be installed.
Here is an example Dockerfile
to demostrate how you can create an effective Docker image to be used in custom environment.
We recommend to choose the base image managed by Razorops having the required tools. The source code of the image is hosted on Github. You can then install additional dependencies, configure environment variables, etc. and finally push to a Docker registry of your choice.
# refer https://hub.docker.com/r/razorci/img/tags
FROM razorci/img:2004
RUN sudo apt-get update && sudo apt-get install -y \
bison \
llvm \
zlib1g-dev \
xz-utils && \
rm -rf /var/lib/apt/lists/*
export IMAGE_NAME=/acme/base
export VERSION=v1
export AWS_ACCOUNT_ID=xxxxxx
export AWS_REGION=us-east-1
export IMAGE=$AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com
docker build -t $IMAGE:$VERSION .
docker push $IMAGE:$VERSION
Afterwards, you can use the docker image in .razorops.yaml
-
tasks:
unit-test:
runner: xxxxxx.dkr.ecr.us-east-1.amazonaws.com/acme/base:v1
steps:
...
integration-test:
runner: quay.io/acme/base:v2
steps:
...