Skip to content

Commit 5f93592

Browse files
committed
Improve pre-commit setup
1 parent 24ffa4a commit 5f93592

File tree

4 files changed

+5
-22
lines changed

4 files changed

+5
-22
lines changed

.devcontainer/Dockerfile

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,5 @@ RUN apt-get update && apt-get install -y \
77

88
RUN pip install clang-format pre-commit
99

10-
COPY docker-entrypoint.sh /
11-
RUN chmod +x /docker-entrypoint.sh
12-
13-
ENTRYPOINT [ "/docker-entrypoint.sh" ]
14-
CMD [ "sleep", "infinity" ]
10+
COPY post-start.sh /
11+
RUN chmod +x /post-start.sh

.devcontainer/devcontainer.json

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,6 @@
66
"dockerfile": "Dockerfile"
77
},
88

9-
// Features to add to the dev container. More info: https://containers.dev/features.
10-
// "features": {},
11-
12-
// Use 'forwardPorts' to make a list of ports inside the container available locally.
13-
// "forwardPorts": [],
14-
15-
// Use 'postCreateCommand' to run commands after the container is created.
16-
// "postCreateCommand": "gcc -v",
17-
18-
// Configure tool-specific properties.
199
"customizations": {
2010
"vscode": {
2111
"extensions": [
@@ -34,8 +24,5 @@
3424
}
3525
},
3626

37-
"overrideCommand": false
38-
39-
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
40-
// "remoteUser": "root"
27+
"postStartCommand": "cd ${containerWorkspaceFolder} && /post-start.sh"
4128
}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env bash
22

3+
echo "Installing pre-commit hooks"
34
pre-commit install --install-hooks
4-
5-
exec "$@"

.github/workflows/devcontainer-command.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ jobs:
3636
imageName: ${{ env.IMAGE_NAME }}
3737
cacheFrom: ${{ env.IMAGE_NAME }}
3838
push: always
39-
runCmd: pre-commit install --install-hooks && ${{ inputs.run_cmd }}
39+
runCmd: /post-start.sh && ${{ inputs.run_cmd }}

0 commit comments

Comments
 (0)