Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Dmytro Bogatov
Docker-Images
Commits
cae788e9
Commit
cae788e9
authored
Oct 31, 2022
by
Dmytro Bogatov
💕
Browse files
Update multi-arch build scripts and latex image
[skip-ci]
parent
60186abf
Pipeline
#35623
skipped
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
build-one.sh
View file @
cae788e9
...
...
@@ -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!"
images/latex-base/Dockerfile
View file @
cae788e9
...
...
@@ -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/202
1
/bin/x86_64-linux:$PATH
ENV
PATH=/usr/local/texlive/202
1
/bin/aarch64-linux/:$PATH
ENV
PATH=/usr/local/texlive/202
2
/bin/x86_64-linux:$PATH
ENV
PATH=/usr/local/texlive/202
2
/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
\
...
...
images/latex/Dockerfile
View file @
cae788e9
...
...
@@ -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"]
images/latex/build-biber-pdfjam.sh
View file @
cae788e9
...
...
@@ -197,8 +197,8 @@ EOF
/biber
-h
/pdfjam
-h
cp
/biber /usr/local/texlive/202
1
/bin/aarch64-linux/biber
cp
/pdfjam /usr/local/texlive/202
1
/bin/aarch64-linux/pdfjam
cp
/biber /usr/local/texlive/202
2
/bin/aarch64-linux/biber
cp
/pdfjam /usr/local/texlive/202
2
/bin/aarch64-linux/pdfjam
echo
"Done."
...
...
images/latex/install-annotator.sh
View file @
cae788e9
...
...
@@ -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."
images/latex/latex-pax-master.zip
0 → 100644
View file @
cae788e9
File added
images/latex/sample.pdf
0 → 100644
View file @
cae788e9
File added
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment