Skip to content

Commit 556ccf8

Browse files
committed
refactor: streamline Docker build and .deb packaging process
1 parent 9db87c3 commit 556ccf8

File tree

2 files changed

+16
-25
lines changed

2 files changed

+16
-25
lines changed

tools/container-build.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,27 +33,27 @@ case "$PLATFORM" in
3333
*) echo "Unsupported platform: ${PLATFORM}" && exit 1 ;;
3434
esac
3535

36+
# Define single tag to avoid collisions and redundancy
37+
TAG="boulder:${VERSION}-${ARCH}"
38+
3639
# Create platform-specific image
3740
docker buildx build \
3841
--file Containerfile \
3942
--platform "$PLATFORM" \
4043
--build-arg "COMMIT_ID=${COMMIT_ID}" \
4144
--build-arg "GO_VERSION=${GO_VERSION}" \
4245
--build-arg "VERSION=${VERSION}" \
43-
--tag "boulder:${VERSION}-${ARCH}" \
44-
--tag "boulder:${VERSION}" \
45-
--tag "boulder:${COMMIT_ID}" \
46-
--tag boulder \
46+
--tag "${TAG}" \
4747
--load \
4848
.
4949

5050
# Create tarball
51-
docker run "boulder:${VERSION}-${ARCH}" tar -C /opt/boulder -cpz . > "./boulder-${VERSION}-${COMMIT_ID}.${ARCH}.tar.gz"
51+
docker run "${TAG}" tar -C /opt/boulder -cpz . > "./boulder-${VERSION}-${COMMIT_ID}.${ARCH}.tar.gz"
5252

5353
# Create .deb package
5454
docker run -v .:/boulderrepo \
5555
-e "COMMIT_ID=${COMMIT_ID}" \
5656
-e "VERSION=${VERSION}" \
5757
-e "ARCH=${ARCH}" \
58-
"boulder:${VERSION}-${ARCH}" \
58+
"${TAG}" \
5959
/boulderrepo/tools/make-deb.sh

tools/make-deb.sh

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,34 @@
11
#!/usr/bin/env bash
22
#
3-
# Produce a .deb from a built Boulder plus helper files.
3+
# Produce a .deb package from a built Boulder container.
44
#
5-
# This script expects to run on Ubuntu, as configured on GitHub Actions runners
6-
# (with curl, make, and git installed).
5+
# This script is executed inside the Boulder Docker container by container-build.sh.
6+
# It packages the Boulder binary and assets into a Debian package for distribution.
77
#
88
# -e Stops execution in the instance of a command or pipeline error.
99
# -u Treat unset variables as an error and exit immediately.
1010
set -eu
11-
cd "$(realpath -- "$(dirname -- "$0")")/.."
1211

13-
BUILD="$(mktemp -d)"
12+
if [ -z "${VERSION:-}" ]; then echo "VERSION not set"; exit 1; fi
13+
if [ -z "${COMMIT_ID:-}" ]; then echo "COMMIT_ID not set"; exit 1; fi
14+
if [ -z "${ARCH:-}" ]; then echo "ARCH not set"; exit 1; fi
1415

16+
BUILD="$(mktemp -d)"
1517
mkdir -p "${BUILD}/opt"
1618
cp -a /opt/boulder "${BUILD}/opt/boulder"
1719

18-
# Determine architecture - use ARCH env var if set, otherwise detect from uname
19-
if [ -n "${ARCH:-}" ]; then
20-
DEB_ARCH="${ARCH}"
21-
else
22-
case "$(uname -m)" in
23-
"x86_64") DEB_ARCH="amd64" ;;
24-
"aarch64"|"arm64") DEB_ARCH="arm64" ;;
25-
*) echo "Unsupported architecture: $(uname -m)" && exit 1 ;;
26-
esac
27-
fi
28-
2920
mkdir -p "${BUILD}/DEBIAN"
30-
cat > "${BUILD}/DEBIAN/control" <<-EOF
21+
cat >"${BUILD}/DEBIAN/control" <<-EOF
3122
Package: boulder
3223
Version: 1:${VERSION}
3324
License: Mozilla Public License v2.0
3425
Vendor: ISRG
35-
Architecture: ${DEB_ARCH}
26+
Architecture: ${ARCH}
3627
Maintainer: Community
3728
Section: default
3829
Priority: extra
3930
Homepage: https://github.com/letsencrypt/boulder
4031
Description: Boulder is an ACME-compatible X.509 Certificate Authority
4132
EOF
4233

43-
dpkg-deb -Zgzip -b "${BUILD}" "boulder-${VERSION}-${COMMIT_ID}.${DEB_ARCH}.deb"
34+
dpkg-deb -Zgzip -b "${BUILD}" "boulder-${VERSION}-${COMMIT_ID}.${ARCH}.deb"

0 commit comments

Comments
 (0)