Skip to content

Commit e142024

Browse files
committed
Add support for Bookworm and ARM64, build all variants in script.
1 parent 43a76f5 commit e142024

File tree

4 files changed

+43
-15
lines changed

4 files changed

+43
-15
lines changed

.dockerignore

+4
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
target/
22
Dockerfile
3+
build-deb-in-docker.sh
4+
*.deb
5+
DEB/
6+

Dockerfile

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
FROM rust:1-bullseye
2-
3-
RUN cargo install cargo-deb
1+
ARG DEBIAN_VER=bookworm
2+
FROM rust:1-${DEBIAN_VER}
43

54
RUN apt-get -qy update
6-
RUN apt-get -qy install lsb-release
5+
RUN apt-get -qy install lsb-release libssl-dev
6+
RUN cargo install cargo-deb
77

88
WORKDIR /root
99
RUN mkdir /root/OUTPUT
1010
COPY . .
11-

build-deb-in-docker.sh

+34-9
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,41 @@
11
#!/bin/bash
22
set -e
33

4-
IMG="ldap_authz_proxy-deb:latest"
4+
is_arch_supported() {
5+
local arch=$1
6+
local deb=$2
7+
docker build --platform linux/$arch - <<EOF
8+
FROM rust:1-$deb
9+
RUN echo "Testing architecture $arch"
10+
EOF
11+
}
12+
13+
for ARCH in amd64 arm64; do
14+
for DEBIAN_VER in bookworm bullseye; do
15+
if is_arch_supported $ARCH $DEBIAN_VER; then
16+
echo "=== Building for $DEBIAN_VER:$ARCH ==="
17+
IMG="ldap_authz_proxy-deb_${ARCH}:latest"
18+
docker build --platform linux/${ARCH} --build-arg DEBIAN_VER=${DEBIAN_VER} -t ${IMG} .
19+
docker run --platform linux/${ARCH} --rm -iv${PWD}:/root/OUTPUT ${IMG} bash -s << EOF
20+
cd /root
21+
22+
cargo deb || exit 1
23+
chown -v $(id -u):$(id -g) target/debian/*.deb
524
6-
docker build -t $IMG .
7-
docker run --rm -iv${PWD}:/root/OUTPUT $IMG sh -s << EOF
8-
cd /root
9-
cargo deb || exit 1
10-
chown -v $(id -u):$(id -g) target/debian/*.deb
11-
cp -va target/debian/*.deb OUTPUT/
12-
echo "============ Done. Built for: ============="
13-
lsb_release -a
25+
for x in target/debian/*.deb; do
26+
NEWFILE=\$(echo "\$x" | sed -E "s/(.*_)/\1${DEBIAN_VER}_/")
27+
mv "\$x" "\$NEWFILE"
28+
done
29+
30+
cp -va target/debian/*.deb OUTPUT/
31+
echo "============ Done. Built for: ============="
32+
lsb_release -a
1433
EOF
34+
else
35+
echo "=== Platform availability test (is_arch_supported) failed for $DEBIAN_VER:$ARCH. Skipping it..."
36+
fi
37+
done
38+
done
39+
1540
echo "=============== $(pwd) ==============="
1641
ls -l *.deb

src/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ pub(crate) fn parse_config(config_file: &str) -> Result<Vec<ConfigSection>, Erro
207207
if seen_sections.contains(&section_name) {
208208
bail!("Duplicate section [{}]", section_name);
209209
} else {
210-
seen_sections.insert(section_name.clone());
210+
seen_sections.insert(section_name);
211211
}
212212

213213
// Check that no unknown keys are set

0 commit comments

Comments
 (0)