Skip to content

Commit 4481ba9

Browse files
committed
fix
Signed-off-by: yuluo-yx <[email protected]>
1 parent a6affa6 commit 4481ba9

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

Dockerfile.precommit

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - && \
1515
apt-get install -y nodejs
1616

1717
# Install Rust
18-
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
19-
. $HOME/.cargo/env
18+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
19+
ENV PATH="/root/.cargo/bin:${PATH}"
2020

2121
# Markdown
2222
RUN npm install -g markdownlint-cli

tools/make/pre-commit.mk

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,21 @@ precommit-check:
2323

2424
# Run pre-commit hooks in a Docker container
2525
# and you can exec container to run bash for debug.
26+
# export PRECOMMIT_CONTAINER=ghcr.io/vllm-project/semantic-router/precommit:latest
2627
# docker run --rm -it \
27-
# -v $(shell pwd):/app \
28-
# --name precommit-container ${PRECOMMIT_CONTAINER} \
29-
# cd /app &&
30-
# bash
28+
# -v $(pwd):/app \
29+
# -w /app \
30+
# --name precommit-container ${PRECOMMIT_CONTAINER} \
31+
# bash
3132
precommit-local:
32-
docker pull ${PRECOMMIT_CONTAINER}
33+
@if ! docker image inspect ${PRECOMMIT_CONTAINER} > /dev/null 2>&1; then \
34+
echo "Image not found locally. Pulling..."; \
35+
docker pull ${PRECOMMIT_CONTAINER}; \
36+
else \
37+
echo "Image found locally. Skipping pull."; \
38+
fi
3339
docker run --rm \
34-
-v $(pwd):/app \
35-
--name precommit-container ${PRECOMMIT_CONTAINER}
36-
cd /app && \
37-
pre-commit install && \
38-
pre-commit run --all-files
40+
-v $(pwd):/app \
41+
-w /app \
42+
--name precommit-container ${PRECOMMIT_CONTAINER} \
43+
bash -c " pre-commit install && pre-commit run --all-files"

0 commit comments

Comments
 (0)