-
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.
wip: primitive automation to build for different docker-based linuxes
- Loading branch information
1 parent
ae4ebcf
commit 6d6aa38
Showing
4 changed files
with
74 additions
and
0 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,13 @@ | ||
ARG OS | ||
FROM $OS | ||
|
||
ARG PAC | ||
|
||
RUN rm /bin/sh && ln -s /bin/bash /bin/sh | ||
RUN $PAC update && $PAC install -y git gcc curl | ||
|
||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > /tmp/rustup && sh /tmp/rustup -y | ||
ADD scripts/build-internal.sh / | ||
RUN mkdir -p /dummy/src | ||
COPY Cargo.toml /dummy | ||
RUN source $HOME/.cargo/env && cd /dummy && echo "// dummy file" > src/lib.rs && cargo build --release |
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,4 @@ | ||
# short name # docker from # pac mgr cmd | ||
centos7 centos:7.9.2009 yum | ||
rocky9 rockylinux:9.3 yum | ||
debian12 debian:12.4 apt-get |
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,13 @@ | ||
#!/bin/bash | ||
|
||
if [ $# -ne 1 ]; then | ||
echo usage $0 \<os_ident\> | ||
exit 1 | ||
fi | ||
|
||
cd / | ||
git clone /src/ bigarchiver && \ | ||
cd bigarchiver/ && \ | ||
cargo test --release && cargo build --release && \ | ||
mkdir -pv /src/scripts/build/$1/ && \ | ||
cp -v target/release/bigarchiver /src/scripts/build/$1/ |
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,44 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
if [ $# -eq 0 ]; then | ||
echo usage $0 --image\|--app [ os_ident ] | ||
exit 1 | ||
fi | ||
|
||
cat PLATFORMS | sed '/^#/d;/^[[:space:]]*$/d' | while read LINE; do | ||
WORDS=($LINE) | ||
if [ ${#WORDS[@]} -ne 3 ]; then | ||
echo Invalid PLATFORMS file | ||
exit 1 | ||
fi | ||
|
||
IDENT=${WORDS[0]} | ||
IMAGE_FROM=${WORDS[1]} | ||
PAC_MGR=${WORDS[2]} | ||
|
||
if [ -n "$2" ]; then | ||
if [ x"$IDENT" != x"$2" ] ; then | ||
continue | ||
fi | ||
fi | ||
|
||
cd .. | ||
case $1 in | ||
--image) | ||
echo preparing build image for $IDENT | ||
docker build -t bigarchiver-$IDENT -f scripts/Dockerfile.template --build-arg OS=$IMAGE_FROM --build-arg PAC=$PAC_MGR . | ||
;; | ||
--app) | ||
echo building application for $IDENT | ||
docker run -v=.:/src bigarchiver-$IDENT /bin/bash -l -c "/build-internal.sh $IDENT" | ||
;; | ||
*) | ||
echo invalid usage | ||
exit 3 | ||
esac | ||
cd scripts | ||
done | ||
|
||
echo all done |