github.com/letsencrypt/boulder@v0.20251208.0/tools/container-build.sh (about) 1 #!/usr/bin/env bash 2 # 3 # Build a Docker container of Boulder (plus ancillary files), and emit both 4 # a .tar.gz and a .deb in the current directory, containing Boulder plus the 5 # ancillary files. 6 # 7 8 set -ex 9 10 # Without this, `go install` produces: 11 # # runtime/cgo 12 # gcc: error: unrecognized command-line option '-m64' 13 if [ "$(uname -m)" = "arm64" ]; then 14 export DOCKER_DEFAULT_PLATFORM=linux/amd64 15 fi 16 17 if [ -z "${GO_VERSION}" ] ; then 18 echo "GO_VERSION not set" 19 exit 1 20 fi 21 22 ARCH="$(uname -m)" 23 COMMIT_ID="$(git rev-parse --short=8 HEAD)" 24 VERSION="${GO_VERSION}.$(date +%s)" 25 26 docker buildx build \ 27 --file Containerfile \ 28 --build-arg "COMMIT_ID=${COMMIT_ID}" \ 29 --build-arg "GO_VERSION=${GO_VERSION}" \ 30 --build-arg "VERSION=${VERSION}" \ 31 --tag "boulder:${VERSION}" \ 32 --tag "boulder:${COMMIT_ID}" \ 33 --tag boulder \ 34 . 35 36 docker run boulder tar -C /opt/boulder -cpz . > "./boulder-${VERSION}-${COMMIT_ID}.${ARCH}.tar.gz" . 37 # Produces e.g. boulder-1.25.0.1754519595-591c0545.x86_64.deb 38 docker run -v .:/boulderrepo \ 39 -e "COMMIT_ID=$(git rev-parse --short=8 HEAD)" \ 40 -e "VERSION=${VERSION}" \ 41 boulder \ 42 /boulderrepo/tools/make-deb.sh