Dockerfile: use ARG for Alpine version

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
v0.8
Akihiro Suda 2020-11-06 16:19:42 +09:00
parent aba69fa102
commit d2cea325e2
No known key found for this signature in database
GPG Key ID: 49524C6F9F638F1A
1 changed files with 6 additions and 2 deletions

View File

@ -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