From 39bf749c0715efed07d8e2f26b1d2d790506234c Mon Sep 17 00:00:00 2001 From: Valina Li Date: Thu, 7 Jul 2022 14:51:26 -0700 Subject: [PATCH] update fix Signed-off-by: Valina Li --- cmd/security-bootstrapper/Dockerfile | 19 ++++++++----------- cmd/security-bootstrapper/entrypoint.sh | 4 ++-- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/cmd/security-bootstrapper/Dockerfile b/cmd/security-bootstrapper/Dockerfile index 23a5a47434..15225e9e10 100644 --- a/cmd/security-bootstrapper/Dockerfile +++ b/cmd/security-bootstrapper/Dockerfile @@ -35,21 +35,21 @@ RUN make cmd/security-bootstrapper/security-bootstrapper FROM alpine:3.14 LABEL license='SPDX-License-Identifier: Apache-2.0' \ - copyright='Copyright (c) 2021 Intel Corporation' + copyright='Copyright (c) 2022 Intel Corporation' RUN apk add --update --no-cache dumb-init su-exec ENV SECURITY_INIT_DIR /edgex-init -ARG BOOTSTRAP_REDIS_DIR=${SECURITY_INIT_DIR}/bootstrap-redis +ENV SECURITY_INIT_STAGING /edgex-init-staging +ARG BOOTSTRAP_REDIS_DIR=${SECURITY_INIT_STAGING}/bootstrap-redis -RUN mkdir -p ${SECURITY_INIT_DIR} \ - && mkdir -p ${BOOTSTRAP_REDIS_DIR} +RUN mkdir -p ${BOOTSTRAP_REDIS_DIR} -WORKDIR ${SECURITY_INIT_DIR} +WORKDIR ${SECURITY_INIT_STAGING} # copy all entrypoint scripts into shared folder -COPY --from=builder /edgex-go/cmd/security-bootstrapper/entrypoint-scripts/ ${SECURITY_INIT_DIR}/ -RUN chmod +x ${SECURITY_INIT_DIR}/*.sh +COPY --from=builder /edgex-go/cmd/security-bootstrapper/entrypoint-scripts/ ${SECURITY_INIT_STAGING}/ +RUN chmod +x ${SECURITY_INIT_STAGING}/*.sh COPY --from=builder /edgex-go/Attribution.txt / COPY --from=builder /edgex-go/cmd/security-bootstrapper/security-bootstrapper . @@ -59,10 +59,7 @@ COPY --from=builder /edgex-go/cmd/security-bootstrapper/res/configuration.toml . COPY --from=builder /edgex-go/cmd/security-bootstrapper/res-bootstrap-redis/configuration.toml ${BOOTSTRAP_REDIS_DIR}/res/ # copy Consul ACL related configs -COPY --from=builder /edgex-go/cmd/security-bootstrapper/consul-acl/ ${SECURITY_INIT_DIR}/consul-bootstrapper/ - -# Expose the file directory as a volume since there's long-running state -VOLUME ${SECURITY_INIT_DIR} +COPY --from=builder /edgex-go/cmd/security-bootstrapper/consul-acl/ ${SECURITY_INIT_STAGING}/consul-bootstrapper/ # setup entry point script COPY --from=builder /edgex-go/cmd/security-bootstrapper/entrypoint.sh / diff --git a/cmd/security-bootstrapper/entrypoint.sh b/cmd/security-bootstrapper/entrypoint.sh index 5f71c40016..228c228076 100755 --- a/cmd/security-bootstrapper/entrypoint.sh +++ b/cmd/security-bootstrapper/entrypoint.sh @@ -37,6 +37,7 @@ EDGEX_USER_ID=${EDGEX_USER:-$DEFAULT_EDGEX_USER_ID} # which then injecting into all other related containers on other services' entrypoint scripts # if the executable is not 'security-bootstrapper'; then we consider it not running the bootstrapping process # for the user may just want to debug into the container shell itself +cp -rpd ${SECURITY_INIT_STAGING}/* ${SECURITY_INIT_DIR}/ if [ "$1" = 'security-bootstrapper' ]; then # run the executable as ${EDGEX_USER} echo "$(date) Executing ./$@" @@ -46,5 +47,4 @@ else # for debug purposes like docker run -it --rm security-bootstrapper:0.0.0-dev /bin/sh echo "current directory:" "$PWD" exec su-exec ${EDGEX_USER_ID} "$@" -fi -cp -rpd /edgex-init/* /edgex-init-staging/ \ No newline at end of file +fi \ No newline at end of file