Built-in build process

This process is meant to provide an easy way to get started with LabTest. It requires some initial setup to allow for easy code checkouts.

Configuration

To use the built-in build process, you must set several configuration parameters.

build_provider must be set to local.

Set code_repo_url to the URL for your code repository.

We’ll discuss app_build_image and app_build_command in the next sections.

There is one optional parameter: container_build_command if you need different options for building the final image.

Build steps

There are only three basic steps:

Built-in build system

The steps LabTest’s built-in build system goes through to generate a Docker image.

  1. Check out code.

  2. Build the application.

  3. Build the Docker image.

Check out code

This step performs a shallow clone of the repo specified in code_repo_url. It uses a machine user to make this process easy to manage, and requires initial setup.

When updates are requested, the cloned repository simply updates the code.

Build the application

Most web apps today require some compilation and building in order to be ready to deploy. To allow for multiple applications to build without conflict, we use a pre-built Docker container with all the tools required.

Docker containers are immutable; any changes made in the container are gone the next time you run the container. The app building process needs to make lasting changes, however. In order to do this, we need to mount the checked out code into the container.

Build environment with mounted volume

The build container mounting the checked out code to the container’s /build directory. Any changes made to the /build directory affect the checked out code.

When we do this, changes made to the mounted directory within the container are made outside the container.

Build environment

The app_build_image setting specifies the Docker image to use as a build environment. This environment should have all the tools you need pre-installed. We suggest choosing one of Shippable’s publicly available images that fits your environment.

Language

Recommended Image

Node.js

drydock/u16nodall

Clojure

drydock/u16cloall

Go

drydock/u16golall

PHP

drydock/u16phpall

Java

drydock/u16javall

Ruby

drydock/u16ruball

Python

drydock/u16pytall

Scala

drydock/u16scaall

C/C++

drydock/u16cppall

You can also create your own custom environments, and specify them instead.

So for a node.js application, you would set app_build_image: drydock/u16nodall.

Build command

This is the command the LabTest runs inside the build environment to complete the build process. We recommend creating a simple script in your code repository to run the commands. For example:

A simple buildapp bash script for a node.js application
#!/bin/bash

nvm use 8
yarn install
yarn run build

You would set app_build_script: ./bin/buildapp, assuming that you made the script executable and put it in the bin directory of your code repository.

Results

After LabTest runs your build command inside your build environment, everything should be ready to build the Docker image.

Build the Docker image

To build the Docker image, LabTest runs the command specified in container_build_command. The default is usually fine. The image is stored on the Laboratory server, which makes running and updating it a bit faster.