|
1 | 1 | ARG ARCH=amd64
|
| 2 | +# Image for dependencies such as NFS binaries |
| 3 | +ARG DEPS_IMAGE=alpine:3 |
2 | 4 |
|
3 |
| -FROM --platform=linux/${ARCH} alpine:latest AS baseimage |
| 5 | +FROM --platform=linux/${ARCH} $DEPS_IMAGE AS deps |
4 | 6 |
|
5 |
| -RUN apk add nfs-utils |
| 7 | +ARG DEPS_IMAGE |
6 | 8 |
|
7 |
| -#Get the mount.nfs4 dependency |
| 9 | +# Installs nfs-utils based on DEPS_IMAGE |
| 10 | +RUN --mount=type=secret,id=activation_key,env=ACTIVATION_KEY \ |
| 11 | + --mount=type=secret,id=organization,env=ORGANIZATION \ |
| 12 | + function unregister() { subscription-manager unregister || true; }; trap unregister EXIT; \ |
| 13 | + if [[ $DEPS_IMAGE =~ "alpine" ]]; \ |
| 14 | + then apk add nfs-utils; \ |
| 15 | + else subscription-manager register --activationkey $ACTIVATION_KEY --org $ORGANIZATION && \ |
| 16 | + yum install --repo=rhel-9-*-baseos-rpms -y nfs-utils; \ |
| 17 | + fi |
| 18 | + |
| 19 | +# Get the mount.nfs4 dependency |
8 | 20 | RUN ldd /sbin/mount.nfs4 | tr -s '[:space:]' '\n' | grep '^/' | xargs -I % sh -c 'mkdir -p /nfs-deps/$(dirname %) && cp -L % /nfs-deps/%'
|
9 | 21 | RUN ldd /sbin/mount.nfs | tr -s '[:space:]' '\n' | grep '^/' | xargs -I % sh -c 'mkdir -p /nfs-deps/$(dirname %) && cp -r -u -L % /nfs-deps/%'
|
10 | 22 |
|
11 |
| -FROM --platform=linux/${ARCH} gcr.io/distroless/static@sha256:69830f29ed7545c762777507426a412f97dad3d8d32bae3e74ad3fb6160917ea |
| 23 | +FROM scratch |
12 | 24 |
|
13 | 25 | LABEL maintainers="The NetApp Trident Team" \
|
14 | 26 | app="trident.netapp.io" \
|
15 | 27 | description="Trident Storage Orchestrator"
|
16 | 28 |
|
17 |
| -COPY --from=baseimage /bin/mount /bin/umount /bin/ |
18 |
| -COPY --from=baseimage /sbin/mount.nfs /sbin/mount.nfs4 /sbin/ |
19 |
| -COPY --from=baseimage /etc/netconfig /etc/ |
20 |
| -COPY --from=baseimage /nfs-deps/ / |
| 29 | +COPY --from=deps /bin/mount /bin/umount /bin/ |
| 30 | +COPY --from=deps /sbin/mount.nfs /sbin/mount.nfs4 /sbin/ |
| 31 | +COPY --from=deps /etc/netconfig /etc/ |
| 32 | +COPY --from=deps /nfs-deps/ / |
21 | 33 |
|
22 | 34 | ARG BIN=trident_orchestrator
|
23 | 35 | ARG CLI_BIN=tridentctl
|
|
0 commit comments