-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.gp2c
executable file
·69 lines (57 loc) · 2.44 KB
/
Dockerfile.gp2c
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
64
65
66
67
68
69
FROM semenovp/tiny-parigp as builder0
LABEL stage=intermediate
FROM alpine as builder1
LABEL stage=intermediate
ARG gp2c_version="0.0.12"
ENV PARIGP_PREFIX=http://pari.math.u-bordeaux.fr/pub/pari/
SHELL ["/bin/ash", "-o", "pipefail", "-c"]
# Note, gp2c-run can be built only in presence of already installed pari/gp.
COPY --from=builder0 / /
COPY ./dockerfile-commons/curl_and_gpgverify.sh ./dockerfile-commons/reduce_alpine.sh /tmp/
RUN apk update &&\
apk --no-cache add --virtual .helpers musl-dev &&\
\
# Save to the target distribution.
sh /tmp/reduce_alpine.sh -v /target /usr/include /usr/lib
WORKDIR /tmp/
# hadolint ignore=SC2046
RUN apk --no-cache add --virtual .helpers curl grep gnupg build-base &&\
\
# Download & verify the queried gp2c distributives.
export target_name="gp2c-$gp2c_version" &&\
target_url="$PARIGP_PREFIX/GP2C/$target_name.tar.gz" &&\
sh /tmp/curl_and_gpgverify.sh -v "$target_url.asc" "$target_url" &&\
\
# Unpack & install.
tar -xvzf "$target_name.tar.gz" &&\
sh -c 'cd "/tmp/$target_name/" && ./configure && make -j && make install' &&\
\
# Reduce to the minimal size distribution.
## Fetch gp2c and its dependencies.
sh /tmp/reduce_alpine.sh -v /target gp2c\
\
/usr/local/share/gp2c/func.dsc &&\
## Fetch gp2c-run script and its runtime dependencies.
sh /tmp/reduce_alpine.sh -v /target gp2c-run\
\
grep sed cat\
as ld gcc $(find /usr/libexec/gcc -type f -name 'cc1' -or\
-name 'liblto_plugin.so') /usr/lib/libgcc_s.so /usr/lib/libgcc_s.so.1\
\
/usr/lib/gcc/ &&\
\
# Clean out.
rm -rf /tmp/* &&\
apk del .helpers
FROM builder0
ARG vcsref
LABEL \
stage=production \
org.label-schema.name="tiny-parigp" \
org.label-schema.description="Minified PARI/GP + GP2C distributions." \
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 <piotr.k.semenov@gmail.com>'
COPY --from=builder1 /target /
ENTRYPOINT ["sh", "-c"]