File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -31,13 +31,21 @@ precommit-check:
31
31
# bash
32
32
# and then, run `pre-commit install && pre-commit run --all-files` command
33
33
precommit-local :
34
- @if ! docker image inspect ${PRECOMMIT_CONTAINER} > /dev/null 2>&1 ; then \
34
+ @if command -v docker > /dev/null 2>&1 ; then \
35
+ CONTAINER_CMD=docker; \
36
+ elif command -v podman > /dev/null 2>&1 ; then \
37
+ CONTAINER_CMD=podman; \
38
+ else \
39
+ echo " Error: Neither docker nor podman is installed. Please install one of them." ; \
40
+ exit 1; \
41
+ fi ; \
42
+ if ! $$ CONTAINER_CMD image inspect ${PRECOMMIT_CONTAINER} > /dev/null 2>&1 ; then \
35
43
echo " Image not found locally. Pulling..." ; \
36
- docker pull ${PRECOMMIT_CONTAINER} ; \
44
+ $$ CONTAINER_CMD pull ${PRECOMMIT_CONTAINER} ; \
37
45
else \
38
46
echo " Image found locally. Skipping pull." ; \
39
- fi
40
- docker run --rm \
47
+ fi ; \
48
+ $$ CONTAINER_CMD run --rm \
41
49
-v $(shell pwd) :/app \
42
50
-w /app \
43
51
--name precommit-container ${PRECOMMIT_CONTAINER} \
You can’t perform that action at this time.
0 commit comments