1
+ FROM --platform=linux/x86_64 ubuntu:noble
2
+
3
+ LABEL description="Flare Debian package builder"
4
+
5
+ # Set environment variables to prevent interactive prompts
6
+ ENV DEBIAN_FRONTEND=noninteractive
7
+ ENV TZ=UTC
8
+
9
+ # Update package manager and install build dependencies
10
+ RUN apt-get update && apt-get install -y \
11
+ git \
12
+ locales \
13
+ zlib1g-dev \
14
+ build-essential \
15
+ autoconf \
16
+ automake \
17
+ libtool \
18
+ libboost-all-dev \
19
+ libhashkit-dev \
20
+ libtokyocabinet-dev \
21
+ libkyotocabinet-dev \
22
+ uuid-dev \
23
+ pkg-config \
24
+ devscripts \
25
+ debhelper \
26
+ dh-make \
27
+ dpkg-dev \
28
+ fakeroot \
29
+ lsb-release \
30
+ && rm -rf /var/lib/apt/lists/*
31
+
32
+ # Set locale
33
+ RUN locale-gen en_US.UTF-8
34
+ ENV LANG en_US.UTF-8
35
+ ENV LANGUAGE en_US:en
36
+ ENV LC_ALL en_US.UTF-8
37
+
38
+ # Create build directory
39
+ WORKDIR /build
40
+
41
+ # Copy source code
42
+ COPY . /build/flare/
43
+
44
+ # Create build script
45
+ RUN echo '#!/bin/bash\n\
46
+ set -e\n\
47
+ \n\
48
+ echo "=== Building Debian Package for kvs-flare ==="\n\
49
+ \n\
50
+ cd /build/flare\n\
51
+ \n\
52
+ # Set build variables\n\
53
+ BUILD_TYPE=${BUILD_TYPE:-release}\n\
54
+ MACHINE=$(uname -m)\n\
55
+ DEB_ARCH=$(echo $MACHINE | sed -e "s/i686/i386/" -e "s/x86_64/amd64/")\n\
56
+ DEB_TARGET=$(lsb_release -cs)\n\
57
+ FLARE_VERSION=$(head -n 1 debian/changelog | awk "match(\\$0, /[0-9\\.\\-]+/) {print substr(\\$0, RSTART, RLENGTH)}")\n\
58
+ FLARE_BUILD_VERSION=${FLARE_BUILD_VERSION:-1}\n\
59
+ \n\
60
+ echo "Build configuration:"\n\
61
+ echo "BUILD_TYPE=$BUILD_TYPE"\n\
62
+ echo "DEB_ARCH=$DEB_ARCH"\n\
63
+ echo "DEB_TARGET=$DEB_TARGET"\n\
64
+ echo "FLARE_VERSION=$FLARE_VERSION"\n\
65
+ echo "FLARE_BUILD_VERSION=$FLARE_BUILD_VERSION"\n\
66
+ \n\
67
+ # Clean any existing build artifacts\n\
68
+ if [ -f Makefile ]; then\n\
69
+ make distclean || true\n\
70
+ fi\n\
71
+ \n\
72
+ # Remove git files and build artifacts\n\
73
+ find . -name ".git*" -exec rm -rf {} + 2>/dev/null || true\n\
74
+ find . -name "*.o" -delete 2>/dev/null || true\n\
75
+ find . -name "*.lo" -delete 2>/dev/null || true\n\
76
+ find . -name ".libs" -exec rm -rf {} + 2>/dev/null || true\n\
77
+ find . -name "autom4te.cache" -exec rm -rf {} + 2>/dev/null || true\n\
78
+ \n\
79
+ # Update debian/changelog with DEB_TARGET\n\
80
+ if [ "$BUILD_TYPE" = "release" ] && [ -n "$FLARE_VERSION" ]; then\n\
81
+ echo "Updating debian/changelog for release build..."\n\
82
+ sed -i -e "s/${FLARE_VERSION}/${FLARE_VERSION}+${DEB_TARGET}${FLARE_BUILD_VERSION}/g" debian/changelog\n\
83
+ fi\n\
84
+ \n\
85
+ # Prepare source\n\
86
+ if [ ! -f configure ]; then\n\
87
+ echo "Running autogen.sh..."\n\
88
+ ./autogen.sh\n\
89
+ fi\n\
90
+ \n\
91
+ # Build package with debuild\n\
92
+ echo "Running debuild --no-tgz-check -uc -us..."\n\
93
+ echo "y" | debuild --no-tgz-check -uc -us\n\
94
+ \n\
95
+ # Update distribution in changes file\n\
96
+ cd /build\n\
97
+ if ls flare_*.changes >/dev/null 2>&1; then\n\
98
+ echo "Updating distribution in changes file..."\n\
99
+ sed -i -e "s/Distribution: unstable/Distribution: ${DEB_TARGET}/g" flare_*.changes\n\
100
+ fi\n\
101
+ \n\
102
+ # Show results\n\
103
+ echo "=== Build Results ==="\n\
104
+ cd /build\n\
105
+ ls -la *.deb *.ddeb *.dsc *.tar.* *.changes 2>/dev/null || echo "No package files found in /build"\n\
106
+ \n\
107
+ # Copy to output directory from parent (where debuild creates files)\n\
108
+ mkdir -p /output\n\
109
+ find /build -maxdepth 1 -name "*.deb" -exec cp {} /output/ \\;\n\
110
+ find /build -maxdepth 1 -name "*.ddeb" -exec cp {} /output/ \\;\n\
111
+ find /build -maxdepth 1 -name "*.dsc" -exec cp {} /output/ \\;\n\
112
+ find /build -maxdepth 1 -name "*.tar.*" -exec cp {} /output/ \\;\n\
113
+ find /build -maxdepth 1 -name "*.changes" -exec cp {} /output/ \\;\n\
114
+ \n\
115
+ echo "Package files copied to /output/"\n\
116
+ ls -la /output/\n\
117
+ ' > /usr/local/bin/build-package.sh && \
118
+ chmod +x /usr/local/bin/build-package.sh
119
+
120
+ # Set entrypoint
121
+ ENTRYPOINT ["/usr/local/bin/build-package.sh"]
0 commit comments