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.
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.
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 |
|
Clojure |
|
Go |
|
PHP |
|
Java |
|
Ruby |
|
Python |
|
Scala |
|
C/C++ |
|
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:
#!/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.