File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change 2323 AGENT_PATH=" /home/runner/work/datadog-lambda-extension/datadog-lambda-extension/datadog-agent"
2424fi
2525
26- BASE_PATH=$( pwd)
26+ # Move into the root directory, so this script can be called from any directory
27+ SCRIPTS_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " > /dev/null 2>&1 && pwd ) "
28+ ROOT_DIR=$SCRIPTS_DIR /..
29+ cd $ROOT_DIR
30+
2731EXTENSION_DIR=" .layers"
2832TARGET_DIR=$( pwd) /$EXTENSION_DIR
2933
3034# Make sure the folder does not exist
3135rm -rf $EXTENSION_DIR 2> /dev/null
3236
3337mkdir -p $EXTENSION_DIR
34- echo $BASE_PATH
3538
3639# First prepare a folder with only *mod and *sum files to enable Docker caching capabilities
37- mkdir -p $BASE_PATH /scripts/.src $BASE_PATH /scripts/.cache
40+ mkdir -p $ROOT_DIR /scripts/.src $ROOT_DIR /scripts/.cache
3841echo " Copy mod files to build a cache"
39- cp $AGENT_PATH /go.mod $BASE_PATH /scripts/.cache
40- cp $AGENT_PATH /go.sum $BASE_PATH /scripts/.cache
42+ cp $AGENT_PATH /go.mod $ROOT_DIR /scripts/.cache
43+ cp $AGENT_PATH /go.sum $ROOT_DIR /scripts/.cache
4144
4245echo " Compressing all files to speed up docker copy"
43- touch $BASE_PATH /scripts/.src/datadog-agent.tgz
46+ touch $ROOT_DIR /scripts/.src/datadog-agent.tgz
4447cd $AGENT_PATH /..
45- tar --exclude=.git -czf $BASE_PATH /scripts/.src/datadog-agent.tgz datadog-agent
46- cd $BASE_PATH
48+ tar --exclude=.git -czf $ROOT_DIR /scripts/.src/datadog-agent.tgz datadog-agent
49+ cd $ROOT_DIR
4750
4851function docker_build_zip {
4952 arch=$1
You can’t perform that action at this time.
0 commit comments