github.com/rohankumardubey/nomad@v0.11.8/scripts/release/docker-build-all (about) 1 #!/usr/bin/env bash 2 3 # A script for building Linux and Windows nomad release binaries inside Docker 4 # 5 # This is a helper script file that is expected to be invoked 6 # within a docker container with an image created with the Dockerfile present on this directory. 7 # 8 # A sample way of invoking the script is 9 # ``` 10 # docker run --rm \ 11 # -v $(pwd)/.git:/tmp/nomad-git:ro \ 12 # -v /tmp/generated-repo:/tmp/artifacts:rw \ 13 # -e "PRERELEASE_TARGET=${PRERELEASE_TARGET}" \ 14 # -e "RELEASE_TARGET=${RELEASE_TARGET}" \ 15 # -e "NOMAD_VERSION=${NOMAD_VERSION}" \ 16 # nomad-builder:latest \ 17 # /tmp/scripts/docker-build-all 18 # ``` 19 # Namely the script takes the following arguments: 20 # * `/tmp/nomad-git` path being a read-only .git directory with HEAD being the sha to be released 21 # * `NOMAD_VERSION` env-var being the release version to be cut (e.g. `0.9.1-rc1`) 22 # * `PRERELEASE_TARGET` env-var being the prerelease make target, typically `prerelease`. Use `help` to skip `prerelease` step 23 # * `RELEASE_TARGET` env-var being the release make target, typically `release`. 24 # 25 # 26 # The script would then run prerelease steps, commits any generated files, and build all binary files 27 # and stores them to `/tmp/artifacts/repo`. 28 29 set -o errexit 30 set -o xtrace 31 32 cp -r /tmp/nomad-git /opt/gopath/src/github.com/hashicorp/nomad/.git 33 34 cd /opt/gopath/src/github.com/hashicorp/nomad 35 36 # checkout directory from .git and ensures a prestine state 37 git checkout . 38 39 make -f ./scripts/release/Makefile.linux \ 40 "NOMAD_VERSION=${NOMAD_VERSION}" \ 41 "PRERELEASE_TARGET=${PRERELEASE_TARGET}" \ 42 "RELEASE_TARGET=${RELEASE_TARGET}" \ 43 update_version build_releases 44 45 cp -r /opt/gopath/src/github.com/hashicorp/nomad \ 46 /tmp/artifacts/repo