From d2cea325e29adeebb766ed82de01c03f8332ad2a Mon Sep 17 00:00:00 2001 From: Akihiro Suda Date: Fri, 6 Nov 2020 16:19:42 +0900 Subject: [PATCH] Dockerfile: use ARG for Alpine version Signed-off-by: Akihiro Suda --- Dockerfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 35be7d70..13b00f65 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,6 +14,10 @@ ARG SHADOW_VERSION=4.8.1 ARG FUSEOVERLAYFS_VERSION=v1.2.0 ARG STARGZ_SNAPSHOTTER_VERSION=3a04e4c2c116c85b4b66d01945cf7ebcb7a2eb5a +ARG ALPINE_VERSION=3.12 + +FROM alpine:${ALPINE_VERSION} AS alpine + # git stage is used for checking out remote repository sources FROM --platform=$BUILDPLATFORM alpine AS git RUN apk add --no-cache git xz @@ -267,7 +271,7 @@ VOLUME /var/lib/buildkit # newuidmap & newgidmap binaries (shadow-uidmap 4.7-r1) shipped with alpine cannot be executed without CAP_SYS_ADMIN, # because the binaries are built without libcap-dev. # So we need to build the binaries with libcap enabled. -FROM alpine:3.12 AS idmap +FROM alpine AS idmap RUN apk add --no-cache autoconf automake build-base byacc gettext gettext-dev gcc git libcap-dev libtool libxslt RUN git clone https://github.com/shadow-maint/shadow.git /shadow WORKDIR /shadow @@ -278,7 +282,7 @@ RUN ./autogen.sh --disable-nls --disable-man --without-audit --without-selinux - && cp src/newuidmap src/newgidmap /usr/bin # Rootless mode. -FROM alpine:3.12 AS rootless +FROM alpine AS rootless RUN apk add --no-cache fuse3 git xz COPY --from=idmap /usr/bin/newuidmap /usr/bin/newuidmap COPY --from=idmap /usr/bin/newgidmap /usr/bin/newgidmap