Skip to content

Commit

Permalink
update fix
Browse files Browse the repository at this point in the history
Signed-off-by: Valina Li <valina.li@intel.com>
  • Loading branch information
vli11 committed Jul 7, 2022
1 parent b4ae71c commit 39bf749
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
19 changes: 8 additions & 11 deletions cmd/security-bootstrapper/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
Expand All @@ -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 /
Expand Down
4 changes: 2 additions & 2 deletions cmd/security-bootstrapper/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ./$@"
Expand All @@ -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/
fi

0 comments on commit 39bf749

Please sign in to comment.