From 97647032f3d23a3caff8c71ee8669f2f8663896c Mon Sep 17 00:00:00 2001 From: Andrew Gouin Date: Tue, 13 Jun 2023 22:35:55 -0600 Subject: [PATCH] fix directory add in cargo buildkit dockerfile (#135) --- dockerfile/cargo/Dockerfile | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/dockerfile/cargo/Dockerfile b/dockerfile/cargo/Dockerfile index c26f81f..fb33e93 100644 --- a/dockerfile/cargo/Dockerfile +++ b/dockerfile/cargo/Dockerfile @@ -132,6 +132,19 @@ RUN bash -c 'set -eux;\ elif [ "${TARGETARCH}" = "amd64" ]; then export ARCH=x86_64; fi;\ LIBRARIES_ARR=($LIBRARIES_ENV); for LIBRARY in "${LIBRARIES_ARR[@]}"; do LIB="$(eval "echo "$LIBRARY"")"; cp $LIB /root/lib/; done' +# Copy over directories +RUN mkdir -p /root/dir_abs && touch /root/dir_abs.list +ARG DIRECTORIES +ENV DIRECTORIES_ENV ${DIRECTORIES} +RUN bash -c 'set -eux;\ + DIRECTORIES_ARR=($DIRECTORIES_ENV);\ + i=0;\ + for DIRECTORY in "${DIRECTORIES_ARR[@]}"; do \ + cp -R $DIRECTORY /root/dir_abs/$i;\ + echo $DIRECTORY >> /root/dir_abs.list;\ + ((i = i + 1));\ + done' + # Use minimal busybox from infra-toolkit image for final scratch image FROM ghcr.io/strangelove-ventures/infra-toolkit:v0.0.7 AS infra-toolkit RUN addgroup --gid 1025 -S heighliner && adduser --uid 1025 -S heighliner -G heighliner @@ -203,19 +216,6 @@ RUN bash -c 'set -eux;\ fi;\ done' -# Copy over directories -RUN mkdir -p /root/dir_abs && touch /root/dir_abs.list -ARG DIRECTORIES -ENV DIRECTORIES_ENV ${DIRECTORIES} -RUN bash -c 'set -eux;\ - DIRECTORIES_ARR=($DIRECTORIES_ENV);\ - i=0;\ - for DIRECTORY in "${DIRECTORIES_ARR[@]}"; do \ - cp -R $DIRECTORY /root/dir_abs/$i;\ - echo $DIRECTORY >> /root/dir_abs.list;\ - ((i = i + 1));\ - done' - # Build final image from scratch FROM scratch