forked from apache/pulsar
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added scripts to build glibc packages for Alpine
- Loading branch information
Showing
6 changed files
with
190 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
|
||
|
||
ARG GLIBC_VERSION=2.38 | ||
|
||
FROM ubuntu:22.04 as build | ||
ARG GLIBC_VERSION | ||
|
||
RUN apt-get -q update \ | ||
&& apt-get -qy install \ | ||
bison \ | ||
build-essential \ | ||
gawk \ | ||
gettext \ | ||
openssl \ | ||
python3 \ | ||
texinfo \ | ||
wget | ||
|
||
# Build GLibc | ||
RUN wget -qO- https://ftpmirror.gnu.org/libc/glibc-${GLIBC_VERSION}.tar.gz | tar zxf - | ||
RUN mkdir /glibc-build | ||
WORKDIR /glibc-build | ||
RUN /glibc-${GLIBC_VERSION}/configure \ | ||
--prefix=/usr/glibc-compat \ | ||
--libdir=/usr/glibc-compat/lib \ | ||
--libexecdir=/usr/glibc-compat/lib \ | ||
--enable-multi-arch \ | ||
--enable-stack-protector=strong | ||
RUN make -j$(nproc) | ||
RUN make install | ||
RUN tar --dereference --hard-dereference -zcf /glibc-bin.tar.gz /usr/glibc-compat | ||
|
||
|
||
################################################ | ||
## Build the APK package | ||
FROM alpine:3.19 | ||
ARG GLIBC_VERSION | ||
|
||
RUN apk add abuild sudo build-base | ||
|
||
RUN mkdir /build | ||
WORKDIR build | ||
|
||
COPY --from=build /glibc-bin.tar.gz /build | ||
|
||
COPY ./scripts /build | ||
|
||
RUN echo "pkgver=\"${GLIBC_VERSION}\"" >> /build/APKBUILD | ||
RUN echo "sha512sums=\"$(sha512sum glibc-bin.tar.gz ld.so.conf)\"" >> /build/APKBUILD | ||
|
||
RUN abuild-keygen -a -i -n | ||
RUN abuild -F -c -r |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<!-- | ||
Licensed to the Apache Software Foundation (ASF) under one | ||
or more contributor license agreements. See the NOTICE file | ||
distributed with this work for additional information | ||
regarding copyright ownership. The ASF licenses this file | ||
to you under the Apache License, Version 2.0 (the | ||
"License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, | ||
software distributed under the License is distributed on an | ||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations | ||
under the License. | ||
--> | ||
|
||
# GLibc compatibility package | ||
|
||
This directory includes the Docker scripts to build an image with GLibc compiled for Alpine Linux. | ||
|
||
This is used to ensure plugins that are going to be used in the Pulsar image and that are depeding on GLibc, will | ||
still be working correctly in the Alpine Image. (eg: Netty Tc-Native and Kinesis Producer Library). | ||
|
||
This image only needs to be re-created when we want to upgrade to a newer version of GLibc. | ||
|
||
# Steps | ||
|
||
1. Change the version in the Dockerfile for this directory. | ||
2. Rebuild the image and push it to Docker Hub: | ||
``` | ||
docker buildx build --platform=linux/amd64,linux/arm64 -t apachepulsar/glibc-base:2.38 . --push | ||
``` | ||
|
||
The image tag is then used in `docker/pulsar/Dockerfile`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
|
||
pkgname="glibc" | ||
pkgrel="0" | ||
pkgdesc="GNU C Library compatibility layer" | ||
arch="all" | ||
url="https:/pulsar.apache.org" | ||
license="LGPL" | ||
options="!check" | ||
source="glibc-bin.tar.gz | ||
ld.so.conf" | ||
subpackages="${pkgname}-bin ${pkgname}-dev" | ||
triggers="glibc-bin.trigger=/lib:/usr/lib:/usr/glibc-compat/lib" | ||
depends="gcompat libuuid" | ||
|
||
package() { | ||
mkdir -p $pkgdir/lib $pkgdir/usr/glibc-compat/lib/locale $pkgdir/usr/glibc-compat/lib64 $pkgdir/etc $pkgdir/usr/glibc-compat/etc/ | ||
cp -a $srcdir/usr $pkgdir | ||
cp $srcdir/ld.so.conf $pkgdir/usr/glibc-compat/etc/ld.so.conf | ||
cd $pkgdir/usr/glibc-compat | ||
rm -rf etc/rpc bin sbin lib/gconv lib/getconf lib/audit share var include | ||
ln -s /usr/glibc-compat/lib/ld-linux-$(uname -m).so.1 $pkgdir/lib | ||
ln -s /usr/glibc-compat/lib/ld-linux-$(uname -m).so.1 $pkgdir/usr/glibc-compat/lib64 | ||
ln -s /usr/glibc-compat/etc/ld.so.cache $pkgdir/etc/ld.so.cache | ||
} | ||
|
||
bin() { | ||
depends="$pkgname bash libc6-compat libgcc" | ||
mkdir -p $subpkgdir/usr/glibc-compat | ||
cp -a $srcdir/usr/glibc-compat/bin $subpkgdir/usr/glibc-compat | ||
cp -a $srcdir/usr/glibc-compat/sbin $subpkgdir/usr/glibc-compat | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
|
||
/usr/local/lib | ||
/usr/glibc-compat/lib | ||
/usr/lib | ||
/lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters