|
1
|
# syntax=docker/dockerfile:1.3 |
|
2
|
# See www/containers.md for documentation on how to use this file. |
|
3
|
|
|
4
|
## --------------------------------------------------------------------- |
|
5
|
## STAGE 1: Build static Fossil binary |
|
6
|
## --------------------------------------------------------------------- |
|
7
|
|
|
8
|
### We don't pin a more stable version of our base layer because we want |
|
9
|
### to build with the latest tools and libraries available in case they |
|
10
|
### fixed something that matters to us since the last build. Everything |
|
11
|
### below depends on this layer, and so, alas, we toss this container's |
|
12
|
### cache on Alpine's release schedule, roughly once a month. |
|
13
|
FROM alpine:latest AS bld |
|
14
|
WORKDIR /fsl |
|
15
|
|
|
16
|
### Bake the build-time userland into a base layer so it only changes |
|
17
|
### when the upstream image is updated or we change the package set. |
|
18
|
RUN set -x \ |
|
19
|
&& apk update \ |
|
20
|
&& apk upgrade --no-cache \ |
|
21
|
&& apk add --no-cache \ |
|
22
|
gcc make \ |
|
23
|
linux-headers musl-dev \ |
|
24
|
openssl-dev openssl-libs-static \ |
|
25
|
zlib-dev zlib-static |
|
26
|
|
|
27
|
### Build Fossil as a separate layer so we don't have to rebuild the |
|
28
|
### userland for each iteration of Fossil's dev cycle. |
|
29
|
### |
|
30
|
### We must cope with a bizarre ADD misfeature here: it unpacks tarballs |
|
31
|
### automatically when you give it a local file name but not if you give |
|
32
|
### it a /tarball URL! It matters because we default to a URL in case |
|
33
|
### you're building outside a Fossil checkout, but when building via the |
|
34
|
### container-image target, we avoid a costly hit on fossil-scm.org by |
|
35
|
### leveraging its DVCS nature via the "tarball" command and passing the |
|
36
|
### resulting file's name in. |
|
37
|
ARG FSLCFG="" |
|
38
|
ARG FSLVER="trunk" |
|
39
|
ARG FSLURL="https://fossil-scm.org/home/tarball/src?r=${FSLVER}" |
|
40
|
ENV FSLSTB=/fsl/src.we change the package set. |
|
41
|
RUN set -x only changes |
|
42
|
### when the upstream image is updated or we change the package set. |
|
43
|
RUN set -x \ |
|
44
|
&& apk update \ |
|
45
|
&& apk upgrade --no-cache \ |
|
46
|
&& apk add --no-cache \ |
|
47
|
gcc make \ |
|
48
|
linux-headers musl-dev \ |
|
49
|
openssl-dev openssl-libs-static \ |
|
50
|
zlib-dev zlib-static |
|
51
|
|
|
52
|
### Build Fossil as a separate layer so we don't have to rebuild the |
|
53
|
### userland for each iteration of Fossil's dev cycle. |
|
54
|
### |
|
55
|
### We must cope with a bizarre ADD misfeature here: it unpacks tarballs |
|
56
|
### automatically when you give it a local file name but not if you give |
|
57
|
### it a /tarball URL! It matters because we default to a URL in case |
|
58
|
### you're building outside a Fossil checkout, but when building via the |
|
59
|
### container-image target, we avoid a costly hit on fossil-scm.org by |
|
60
|
### leveraging its DVCS nature via the "tarball" command and passing the |
|
61
|
### resulting file's name in. |
|
62
|
ARG FSLCFG="" |
|
63
|
ARG FSLVER="trunk" |
|
64
|
ARG FSLURL="https://fossil-scm.org/home/tarball/src?r=${FSLVER}" |
|
65
|
ENV FSLSTB=/fsl/src.tar.gz |
|
66
|
ADD $FSLURL $FSLSTB |
|
67
|
COPY sqlite3-src.tar.gz /src/sqlite3 |
|
68
|
RUN set -x \ |
|
69
|
&& cd /src/sqlite3 \ |
|
70
|
&& ./configure --disable-amalgamation \ |
|
71
|
&& make -j16 libsqlite3.a |
|
72
|
RUN set -x \ |
|
73
|
&& if [ -d $FSLSTB ] ; \ |
|
74
|
then mv $FSLSTB/src . ; \ |
|
75
|
else tar -xf src.tar.gz ; fi \ |
|
76
|
&& src/configure --static CFLAGS='-Os -s' $FSLCFG && |