forked from rockhunters08/haproxy-2.6
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-deb.sh
More file actions
executable file
·109 lines (90 loc) · 2.73 KB
/
build-deb.sh
File metadata and controls
executable file
·109 lines (90 loc) · 2.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/bash
set -e
# Configuration
VERSION="2.6.23"
PACKAGE_VERSION="2.6.23-flipboard"
ARCH="arm64"
PACKAGE_NAME="haproxy_${PACKAGE_VERSION}_${ARCH}.deb"
echo "Building HAProxy ${PACKAGE_VERSION} for ${ARCH}..."
# Create build directory structure
BUILD_DIR="builds/haproxy-build"
PKG_DIR="${BUILD_DIR}/debian-pkg"
OUTPUT_DIR="builds"
mkdir -p ${OUTPUT_DIR}
rm -rf ${BUILD_DIR}
mkdir -p ${PKG_DIR}/{DEBIAN,usr/sbin}
# Install build dependencies and build HAProxy inside the container
docker run --rm --platform linux/arm64 \
-v $(pwd):/workspace \
-w /workspace \
ubuntu:22.04 /bin/bash -c '
set -e
# Install dependencies
apt-get update
apt-get install -y \
build-essential \
libpcre3-dev \
libssl-dev \
zlib1g-dev \
libsystemd-dev \
liblua5.3-dev \
ca-certificates
echo "Building HAProxy..."
# Build HAProxy
make clean || true
make -j$(nproc) TARGET=linux-glibc \
USE_PCRE=1 \
USE_OPENSSL=1 \
USE_ZLIB=1 \
USE_SYSTEMD=1 \
USE_LUA=1 \
USE_PROMEX=1 \
USE_THREAD=1
echo "HAProxy build complete"
# Copy binary to build directory
cp haproxy '${PKG_DIR}/usr/sbin/'
chmod 755 '${PKG_DIR}/usr/sbin/haproxy'
echo "Binary copied to package directory"
'
# Create control file
cat > ${PKG_DIR}/DEBIAN/control << EOF
Package: haproxy
Version: ${PACKAGE_VERSION}
Section: net
Priority: optional
Architecture: ${ARCH}
Depends: libc6, libpcre3, libssl3 | libssl1.1, zlib1g, libsystemd0, liblua5.3-0
Maintainer: Flipboard OPS <ops@flipboard.com>
Description: Fast and reliable load balancing reverse proxy
HAProxy is a TCP/HTTP reverse proxy which is particularly suited for high
availability environments. It features connection persistence through HTTP
cookies, load balancing, header addition, modification, deletion both ways.
It has request blocking capabilities and provides interface to display server
status.
.
This is a Flipboard customized build of HAProxy ${VERSION}.
EOF
# Set correct permissions
find ${PKG_DIR} -type d -exec chmod 755 {} \;
# Build the package inside Docker (since dpkg-deb isn't available on macOS)
echo "Building Debian package..."
docker run --rm --platform linux/arm64 \
-v $(pwd):/workspace \
-w /workspace \
ubuntu:22.04 /bin/bash -c "
dpkg-deb --build ${PKG_DIR} ${PACKAGE_NAME}
dpkg-deb --info ${PACKAGE_NAME}
echo ''
echo 'Package contents:'
dpkg-deb --contents ${PACKAGE_NAME}
"
echo ""
echo "Package built successfully: ${PACKAGE_NAME}"
mv ${PACKAGE_NAME} ${OUTPUT_DIR}/${PACKAGE_NAME}
echo "Moved to ${OUTPUT_DIR}/${PACKAGE_NAME}"
echo ""
echo "To upload to S3, run:"
GIT_COMMIT_HASH=$(git rev-parse --short HEAD)
for release in jammy noble; do
echo "aws s3 cp ${OUTPUT_DIR}/${PACKAGE_NAME} s3://flipboard.prod.external/haproxy/${release}/${GIT_COMMIT_HASH}/${PACKAGE_NAME}"
done