Project | Product | Config | Build time | |
---|---|---|---|---|
CPython | CloudVA Forge | 8 CPU, 8 GB | 0m41s | |
CPython | AWS CodeBuild | 8 CPU, 15 GB | 1m53s | 3x slower |
CPython | Github Actions | 2 CPU, 7 GB | 2m31s | 4x slower |
Node.js | CloudVA Forge | 4 CPU, 15 GB | 0h27m | |
Node.js | CircleCI | 4 CPU, 15 GB | 1h18m | 3x slower |
Node.js | Github Actions | 2 CPU, 7 GB | 1h50m | 4x slower |
prepare:
section, runs commands on the host before building docker imageenvironment:
YAML section.Tag: cpython-builder-ubuntu2004 YAML: -------------------------------------------- enviroment: # Would be set automatically if we used Github integration through Forge Triggers - GITHUB_REPOSITORY: "https://github.com/python/cpython" prepare: - git clone $GITHUB_REPOSITORY project -------------------------------------------- Dockerfile: -------------------------------------------- # Prepare ubuntu 20.04 build environment FROM ubuntu:20.04 RUN apt-get update -qq RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata RUN apt-get -y install cmake gcc COPY project/LICENSE.txt /LICENSE.txt # Copies project/LICENSE.txt, which we checked out in "prepare" stage. # "prepare" stage runs on host, so inside the docker we don't need to clone the project # .. or install "git", making the image smaller and faster. --------------------------------------------There is no need to rebuild this image every commit, or even every release, but only when the LICENSE, or build requirements change. You can set up automation so to rebuilt only when necessary.
prepare:
section, runs commands on the host before the docker runsexecute:
section, runs commands inside the docker container specified by Tagarchive:
section, runs commands on the host after the docker runsenvironment:
YAML section.Tag: cpython-builder-ubuntu2004 YAML: -------------------------------------------- enviroment: # Would be set automatically if we used Github integration through Forge Triggers - GITHUB_REPOSITORY: "https://github.com/python/cpython" - GITHUB_SHA: "29f1b0bb1ff73dcc28f0ca7e11794141b6de58c9" prepare: - git clone $GITHUB_REPOSITORY cpython - cd cpython - git checkout $GITHUB_SHA execute: - cd cpython - ./configure - make -j $FORGE_CPU - make test archive: - tar -czvf build.tar.gz cpython/build - save_dir=/media/data/cpython/$GITHUB_SHA - mkdir -p $save_dir - cp build.tar.gz $save_dir --------------------------------------------In our example the archive stage uses Forge shared peristent volume (SPV), but we don't limit your options. You're welcome to store your artifacts outside of Forge.
environment: # present in Dockers and Runs # sets common environment variables for other stages # some enviroment variables are automatically set by Forge - answer: 42 prepare: # present in Dockers and Runs # executes commands on host before Docker:build or Run:execute # typical use: cloning/checking out a repository; installing dependencies - echo $answer # echoes "42" execute: # present only in Runs; Dockers have a "build" stage instead, controlled solely by the Dockerfile # executes commands in docker container defined by Run tag # typical use: building a project; running tests - echo $answer # echoes "42" archive: # present only in Runs # executes commands on host after Run execute stage # typical use: storing build files; saving logs; - echo $answer # echoes "42"
environment: - FORGE_CPU=4 # CPU cores - FORGE_RAM=4096 # RAM in MBYou can use those to control resource usage for Docker and Run flows. If you do not, Forge will set them automatically to some sane defaults. In any case, you can use these variables to limit your build parallelism:
execute: #... - make -j $FORGE_CPUWhen Triggers are used, Forge will set additional environment variables depending on Trigger type. For Github Triggers Forge will copy, as-is, all "GITHUB_*" and "FORGE_*" variables present in the Github action. As a result, all of these are available in Docker and Run flows:
prepare: - git clone $GITHUB_REPOSITORY repo - cd repo - git checkout $GITHUB_REF - make -j $FORGE_CPUNote that variables carrying OS paths local to Github runner such as GITHUB_EVENT_PATH will not be correct, or meaningful, on Forge.
/media/data
.