mirror of
https://github.com/FRRouting/frr.git
synced 2025-04-30 21:47:15 +02:00
docker: Keep and copy .apk files after they are built
For debugging purposes and/or to distribute them somewhere else. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
This commit is contained in:
parent
22432f22da
commit
7be59f7b7c
|
@ -12,16 +12,6 @@ RUN apk add \
|
||||||
&& echo 'builder ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
|
&& echo 'builder ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
|
||||||
RUN adduser -D -G abuild builder && su builder -c 'abuild-keygen -a -n'
|
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
|
# This stage builds a dist tarball from the source
|
||||||
FROM alpine:3.15 as source-builder
|
FROM alpine:3.15 as source-builder
|
||||||
|
|
||||||
|
@ -36,14 +26,7 @@ RUN source /src/alpine/APKBUILD.in \
|
||||||
py-pip \
|
py-pip \
|
||||||
rtrlib \
|
rtrlib \
|
||||||
&& pip install pytest
|
&& pip install pytest
|
||||||
|
|
||||||
RUN mkdir -p /pkgs/apk
|
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
|
COPY . /src
|
||||||
ARG PKGVER
|
ARG PKGVER
|
||||||
RUN cd /src \
|
RUN cd /src \
|
||||||
|
@ -54,12 +37,7 @@ RUN cd /src \
|
||||||
&& make dist
|
&& make dist
|
||||||
|
|
||||||
# This stage builds an APK from the dist tarball
|
# This stage builds an APK from the dist tarball
|
||||||
FROM alpine-builder as frr-apk-builder
|
FROM alpine-builder as alpine-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/
|
COPY --from=source-builder /src/frr-*.tar.gz /src/alpine/* /dist/
|
||||||
RUN find /pkgs/apk -type f -name APKINDEX.tar.gz -delete
|
RUN find /pkgs/apk -type f -name APKINDEX.tar.gz -delete
|
||||||
RUN chown -R builder /dist /pkgs
|
RUN chown -R builder /dist /pkgs
|
||||||
|
@ -72,7 +50,7 @@ RUN cd /dist \
|
||||||
# This stage installs frr from the apk
|
# This stage installs frr from the apk
|
||||||
FROM alpine:3.15
|
FROM alpine:3.15
|
||||||
RUN mkdir -p /pkgs/apk
|
RUN mkdir -p /pkgs/apk
|
||||||
COPY --from=frr-apk-builder /pkgs/apk/ /pkgs/apk/
|
COPY --from=alpine-apk-builder /pkgs/apk/ /pkgs/apk/
|
||||||
RUN apk add \
|
RUN apk add \
|
||||||
--no-cache \
|
--no-cache \
|
||||||
--update-cache \
|
--update-cache \
|
||||||
|
|
|
@ -25,7 +25,16 @@ docker build \
|
||||||
--target=alpine-builder \
|
--target=alpine-builder \
|
||||||
.
|
.
|
||||||
|
|
||||||
CONTAINER_ID="$(docker create "frr:alpine-builder-$GITREV")"
|
# Keep .apk files for debugging purposes, docker image as well.
|
||||||
|
docker build \
|
||||||
|
--pull \
|
||||||
|
--file=docker/alpine/Dockerfile \
|
||||||
|
--build-arg="PKGVER=$PKGVER" \
|
||||||
|
--tag="frr:alpine-apk-builder-$GITREV" \
|
||||||
|
--target=alpine-apk-builder \
|
||||||
|
.
|
||||||
|
|
||||||
|
CONTAINER_ID="$(docker create "frr:alpine-apk-builder-$GITREV")"
|
||||||
docker cp "${CONTAINER_ID}:/pkgs/" docker/alpine
|
docker cp "${CONTAINER_ID}:/pkgs/" docker/alpine
|
||||||
docker rm "${CONTAINER_ID}"
|
docker rm "${CONTAINER_ID}"
|
||||||
|
|
||||||
|
@ -36,3 +45,4 @@ docker build \
|
||||||
.
|
.
|
||||||
|
|
||||||
docker rmi "frr:alpine-builder-$GITREV"
|
docker rmi "frr:alpine-builder-$GITREV"
|
||||||
|
docker rmi "frr:alpine-apk-builder-$GITREV"
|
||||||
|
|
Loading…
Reference in a new issue