Commit cae788e9 authored by Dmytro Bogatov's avatar Dmytro Bogatov 💕
Browse files

Update multi-arch build scripts and latex image

[skip-ci]
parent 60186abf
Pipeline #35623 skipped
......@@ -8,60 +8,83 @@ shopt -s globstar
cd "${0%/*}"
CWD=$(pwd)
usage () {
printf "usage: ./$0 <image>\n"
printf "where\n"
printf "\t image - image name in ./images/ \n"
IMAGE=""
ARCH=multi
DOCKER_REPO=dbogatov/docker-images
exit 1;
usage() {
echo "Usage: $0 -i <IMAGE> [-a <ARCH=multi | linux/arm64/v8 | linux/amd64>]" 1>&2;
exit 1;
}
if ! [ $# -eq 1 ] && ! [ $# -eq 2 ]
while getopts "i:a:" o
do
case "${o}" in
i)
IMAGE=${OPTARG}
;;
a)
ARCH=${OPTARG}
;;
*)
usage
;;
esac
done
shift $((OPTIND-1))
if [ -z $IMAGE ]
then
usage
usage
fi
IMAGE=$1
arches=()
if [ -n "$2" ]
if [ $ARCH = "multi" ]
then
echo "Multi ARCH"
arches+=( "linux/arm64/v8" "linux/amd64" )
else
arches+=( $ARCH )
fi
for arch in "linux/arm64/v8" "linux/amd64"
do
echo "For ${arch}"
echo "Will build for arch(es): ${arches[@]}"
tag_rach="${arch////$'-'}"
for arch in ${arches[@]}
do
echo "For ${arch}"
docker build \
--no-cache \
--pull \
--platform $arch \
-t ${IMAGE}_tmp-$tag_rach \
images/${IMAGE}
tag_rach="${arch////$'-'}"
docker run -v ${CWD}/images/${IMAGE}/test.sh:/test.sh --entrypoint="/bin/bash" ${IMAGE}_tmp-$tag_rach /test.sh
set -x
docker tag ${IMAGE}_tmp-$tag_rach dbogatov/docker-images:${IMAGE}-latest-$tag_rach
docker push dbogatov/docker-images:${IMAGE}-latest-$tag_rach
done
docker build \
--no-cache \
--pull \
--platform $arch \
-t ${IMAGE}_tmp-$tag_rach \
images/${IMAGE}
docker manifest rm dbogatov/docker-images:${IMAGE}-latest-multi-arch || true # it may exist, and we don't want just ammending to that
docker manifest create \
dbogatov/docker-images:${IMAGE}-latest-multi-arch \
--amend dbogatov/docker-images:${IMAGE}-latest-"linux-amd64" \
--amend dbogatov/docker-images:${IMAGE}-latest-"linux-arm64-v8"
docker run -v ${CWD}/images/${IMAGE}/test.sh:/test.sh --entrypoint="/bin/bash" ${IMAGE}_tmp-$tag_rach /test.sh
docker manifest push dbogatov/docker-images:${IMAGE}-latest-multi-arch
else
echo "Single ARCH"
docker tag ${IMAGE}_tmp-$tag_rach $DOCKER_REPO:${IMAGE}-latest-$tag_rach
docker push $DOCKER_REPO:${IMAGE}-latest-$tag_rach
docker build --no-cache --pull -t ${IMAGE}_tmp images/${IMAGE}
docker run -v ${CWD}/images/${IMAGE}/test.sh:/test.sh --entrypoint="/bin/bash" ${IMAGE}_tmp /test.sh
set +x
done
if [ $ARCH = "multi" ]
then
set -x
docker manifest rm $DOCKER_REPO:${IMAGE}-latest-multi-arch || true # it may exist, and we don't want just ammending to that
docker manifest create \
$DOCKER_REPO:${IMAGE}-latest-multi-arch \
--amend $DOCKER_REPO:${IMAGE}-latest-"linux-amd64" \
--amend $DOCKER_REPO:${IMAGE}-latest-"linux-arm64-v8"
docker tag ${IMAGE}_tmp dbogatov/docker-images:${IMAGE}-latest
docker push dbogatov/docker-images:${IMAGE}-latest
docker manifest push $DOCKER_REPO:${IMAGE}-latest-multi-arch
set +x
fi
echo "Done!"
......@@ -8,8 +8,8 @@ ENV LANG=C.UTF-8 \
LC_ALL=C.UTF-8
# put both arch paths, exactly one of them will work, and that's fiine
ENV PATH=/usr/local/texlive/2021/bin/x86_64-linux:$PATH
ENV PATH=/usr/local/texlive/2021/bin/aarch64-linux/:$PATH
ENV PATH=/usr/local/texlive/2022/bin/x86_64-linux:$PATH
ENV PATH=/usr/local/texlive/2022/bin/aarch64-linux/:$PATH
RUN apt-get update \
&& apt-get install -y gnupg curl libgetopt-long-descriptive-perl make libdigest-perl-md5-perl wget unzip poppler-utils fontconfig \
......
......@@ -2,6 +2,15 @@ FROM dbogatov/docker-images:latex-base-latest-multi-arch
LABEL maintainer="Dmytro Bogatov <dmytro@dbogatov.org>"
# Install PAX
ENV TEXMFVAR=/usr/local/texlive/2022/texmf-var
COPY latex-pax-master.zip /tmp
COPY sample.pdf /tmp
COPY install-annotator.sh /
RUN /install-annotator.sh
# Install Biber and PDFjam
COPY build-biber-pdfjam.sh /
RUN /build-biber-pdfjam.sh
......@@ -30,10 +39,5 @@ RUN apt-get update \
RUN echo 'alias pdfjoin="pdfjam --fitpaper true --rotateoversize true --suffix joined "' >> ~/.bashrc
ENV TEXMFVAR=/usr/local/texlive/2021/texmf-var
COPY install-annotator.sh /
RUN /install-annotator.sh
SHELL ["/bin/bash", "-c"]
CMD ["/bin/bash"]
......@@ -197,8 +197,8 @@ EOF
/biber -h
/pdfjam -h
cp /biber /usr/local/texlive/2021/bin/aarch64-linux/biber
cp /pdfjam /usr/local/texlive/2021/bin/aarch64-linux/pdfjam
cp /biber /usr/local/texlive/2022/bin/aarch64-linux/biber
cp /pdfjam /usr/local/texlive/2022/bin/aarch64-linux/pdfjam
echo "Done."
......
......@@ -2,29 +2,22 @@
set -e
ARCH=$(uname -a | awk '{print $(NF-1)}')
echo "Arch: $ARCH"
cd /tmp/
wget http://mirrors.ctan.org/macros/latex/contrib/pax/pax-tds.zip
unzip pax-tds.zip
cd scripts/pax/
unzip latex-pax-master.zip
cd latex-pax-master/scripts/
if [ "$ARCH" = "x86_64" ]
then
apt-get update
apt-get install -y cpanminus
cpanm File::Which
apt-get remove -y cpanminus
apt-get autoremove -y
fi
apt-get update
apt-get install -y cpanminus default-jre
cpanm File::Which
apt-get remove -y cpanminus
apt-get autoremove -y
./pdfannotextractor.pl --install
cp ./pdfannotextractor.pl /
cd /
rm -rf /tmp/*
/pdfannotextractor.pl --version
/pdfannotextractor.pl /tmp/sample.pdf
rm -rf /tmp/*
echo "Done."
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment