blob: 187b5285244695f0d35250293d3784ecee6ebe7f (
plain)
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
# syntax=docker/dockerfile:1
# Create a basic stage set up to build APKs
FROM alpine:3.15 as alpine-builder
RUN apk add \
--update-cache \
abuild \
alpine-conf \
alpine-sdk \
&& setup-apkcache /var/cache/apk \
&& mkdir -p /pkgs/apk \
&& echo 'builder ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
RUN adduser -D -G abuild builder && su builder -c 'abuild-keygen -a -n'
# This stage builds a libyang APK from source
FROM alpine-builder as libyang-builder
RUN mkdir -p /libyang && chown -R builder /pkgs /libyang
# -- Not currently needed - libyang currently available in Alpine upstream
# COPY docker/alpine/libyang/ /libyang
# USER builder
# RUN cd /libyang \
# && abuild checksum \
# && abuild -r -P /pkgs/apk
# This stage builds a dist tarball from the source
FROM alpine:3.15 as source-builder
RUN mkdir -p /src/alpine
COPY alpine/APKBUILD.in /src/alpine
RUN source /src/alpine/APKBUILD.in \
&& apk add \
--no-cache \
--update-cache \
$makedepends \
gzip \
py-pip \
rtrlib \
&& pip install pytest
RUN mkdir -p /pkgs/apk
# -- Not needed while libyang is not built
# COPY --from=libyang-builder /pkgs/apk/ /pkgs/apk/
# RUN apk add \
# --no-cache \
# --allow-untrusted /pkgs/apk/*/*.apk \
COPY . /src
ARG PKGVER
RUN cd /src \
&& ./bootstrap.sh \
&& ./configure \
--enable-numeric-version \
--with-pkg-extra-version="_git$PKGVER" \
&& make dist
# This stage builds an APK from the dist tarball
FROM alpine-builder as frr-apk-builder
# -- Not needed while libyang is not built
# COPY --from=libyang-builder /pkgs/apk/ /pkgs/apk/
# RUN apk add \
# --no-cache \
# --allow-untrusted /pkgs/apk/*/*.apk
COPY --from=source-builder /src/frr-*.tar.gz /src/alpine/* /dist/
RUN find /pkgs/apk -type f -name APKINDEX.tar.gz -delete
RUN chown -R builder /dist /pkgs
USER builder
RUN cd /dist \
&& abuild checksum \
&& git init \
&& abuild -r -P /pkgs/apk
# This stage installs frr from the apk
FROM alpine:3.15
RUN mkdir -p /pkgs/apk
COPY --from=frr-apk-builder /pkgs/apk/ /pkgs/apk/
RUN apk add \
--no-cache \
--update-cache \
tini \
&& apk add \
--no-cache \
--allow-untrusted /pkgs/apk/*/*.apk \
&& rm -rf /pkgs
# Own the config / PID files
RUN mkdir -p /var/run/frr
RUN chown -R frr:frr /etc/frr /var/run/frr
# Simple init manager for reaping processes and forwarding signals
ENTRYPOINT ["/sbin/tini", "--"]
# Default CMD starts watchfrr
COPY docker/alpine/docker-start /usr/lib/frr/docker-start
CMD ["/usr/lib/frr/docker-start"]
|