File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
config/grumphp/hooks/docker Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,14 @@ if [[ ${DOCKER_COMPOSE_DIR} = *"/vendor/"* ]]; then
19
19
DOCKER_COMPOSE_DIR=${VENDOR_PARENT_DIR} /..
20
20
fi
21
21
DOCKER_COMPOSE_FILE=${DOCKER_COMPOSE_DIR} /docker-compose.yml
22
+ DOCKER_PHP_CONTAINER_ID=$( docker-compose -f ${DOCKER_COMPOSE_FILE} ps -q phpfpm)
23
+
24
+ # Remove single quotes from hook_command. It is needed to use it inside the docker exec
25
+ HOOK_COMMAND=$( echo " $( HOOK_COMMAND) " | sed " s/'//g" )
22
26
23
27
# Run GrumPHP
24
- (cd " ${HOOK_EXEC_PATH} " && printf " %s\n" " ${DIFF} " | docker-compose --file ${DOCKER_COMPOSE_FILE} exec -T phpfpm $( HOOK_COMMAND) " --git-user=$GIT_USER " " --git-email=$GIT_EMAIL " " $COMMIT_MSG_FILE " )
28
+ docker exec -t \
29
+ -e DIFF=" ${DIFF} " -e HOOK_EXEC_PATH=${HOOK_EXEC_PATH} -e HOOK_COMMAND=" ${HOOK_COMMAND} " \
30
+ -e GIT_USER=" ${GIT_USER} " -e GIT_EMAIL=" ${GIT_EMAIL} " -e COMMIT_MSG_FILE=" ${COMMIT_MSG_FILE} " \
31
+ ${DOCKER_PHP_CONTAINER_ID} sh -c \
32
+ ' cd "${HOOK_EXEC_PATH}" && printf "%s\n" "${DIFF}" | ${HOOK_COMMAND} --git-user="${GIT_USER}" --git-email="${GIT_EMAIL}" "${COMMIT_MSG_FILE}"'
Original file line number Diff line number Diff line change @@ -15,6 +15,13 @@ if [[ ${DOCKER_COMPOSE_DIR} = *"/vendor/"* ]]; then
15
15
DOCKER_COMPOSE_DIR=${VENDOR_PARENT_DIR} /..
16
16
fi
17
17
DOCKER_COMPOSE_FILE=${DOCKER_COMPOSE_DIR} /docker-compose.yml
18
+ DOCKER_PHP_CONTAINER_ID=$( docker-compose -f ${DOCKER_COMPOSE_FILE} ps -q phpfpm)
19
+
20
+ # Remove single quotes from hook_command. It is needed to use it inside the docker exec
21
+ HOOK_COMMAND=$( echo " $( HOOK_COMMAND) " | sed " s/'//g" )
18
22
19
23
# Run GrumPHP
20
- (cd " ${HOOK_EXEC_PATH} " && printf " %s\n" " ${DIFF} " | docker-compose --file ${DOCKER_COMPOSE_FILE} exec -T phpfpm $( HOOK_COMMAND) )
24
+ docker exec -t \
25
+ -e DIFF=" ${DIFF} " -e HOOK_EXEC_PATH=${HOOK_EXEC_PATH} -e HOOK_COMMAND=" ${HOOK_COMMAND} " \
26
+ ${DOCKER_PHP_CONTAINER_ID} sh -c \
27
+ ' cd "${HOOK_EXEC_PATH}" && printf "%s\n" "${DIFF}" | ${HOOK_COMMAND} --skip-success-output'
You can’t perform that action at this time.
0 commit comments