-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.pari
executable file
·63 lines (53 loc) · 2.3 KB
/
Dockerfile.pari
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
FROM alpine as builder
LABEL stage=intermediate
ARG parigp_version="2.13.0"
ARG parigp_packages="elldata galdata galpol nftables seadata"
ENV PARIGP_PREFIX=http://pari.math.u-bordeaux.fr/pub/pari/
RUN apk update &&\
apk --no-cache add --virtual .helpers bash curl gnupg build-base perl diffutils
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
COPY ./dockerfile-commons/curl_and_gpgverify.sh ./dockerfile-commons/reduce_alpine.sh /tmp/
WORKDIR /tmp
# hadolint ignore=SC2011,SC2010
RUN mkdir ./data &&\
\
# Download & verify the queried pari/gp with the packages.
eval "echo unix/pari-$parigp_version.tar.gz\
packages/{${parigp_packages// /,}}.tgz" | tr ' ' '\n' |\
xargs -I@ sh /tmp/curl_and_gpgverify.sh -v $PARIGP_PREFIX/@.asc $PARIGP_PREFIX/@ || true &&\
\
# Unpack & install.
ls ./*.*gz | xargs gunzip &&\
tar xf "pari-$parigp_version.tar" &&\
(tar xf nftables*.tar -C ./data 2> /dev/null || true) &&\
(ls ./*.tar | grep -Ev 'pari|nftables' | xargs -I@ tar xf @ --strip-components 1 -C ./data || true) &&\
\
bash -c 'cd "/tmp/pari-$parigp_version/" && ./Configure && make gp dobench install' &&\
(cp -r /tmp/data/* /usr/local/share/pari/ || true) &&\
\
# Reduce to the minimal size distribution.
# Tool gphelp is developed in pure Perl, so no need even for core packages.
sh /tmp/reduce_alpine.sh -v /target perl gp gphelp /usr/local/lib/libpari.so\
\
/usr/local/lib/pari/pari.cfg\
\
/usr/local/include/pari\
/usr/local/share/pari/doc &&\
\
(cp -r /tmp/data/* /target/usr/local/share/pari/ || true) &&\
\
# Clean out.
rm -rf /tmp/* &&\
apk del .helpers
FROM scratch
ARG vcsref
LABEL \
stage=production \
org.label-schema.name="tiny-parigp" \
org.label-schema.description="Minified PARI/GP distribution." \
org.label-schema.url="https://hub.docker.com/r/semenovp/tiny-parigp/" \
org.label-schema.vcs-ref="$vcsref" \
org.label-schema.vcs-url="https://github.com/piotr-semenov/parigp-docker.git" \
maintainer='Piotr Semenov <[email protected]>'
COPY --from=builder /target /
ENTRYPOINT ["sh", "-c"]