Skip to content

Commit f0daff0

Browse files
committed
refactor(devcontainer): init pre-commit in postAttach
1 parent 998e2ea commit f0daff0

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

.devcontainer/Dockerfile

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,4 @@ COPY compiler_admin compiler_admin
2020
COPY pyproject.toml pyproject.toml
2121
RUN pip install -e .[dev,test]
2222

23-
# install pre-commit environments in throwaway Git repository
24-
# https://stackoverflow.com/a/68758943
25-
COPY .pre-commit-config.yaml .
26-
RUN git init . && \
27-
pre-commit install-hooks && \
28-
rm -rf .git
29-
3023
CMD ["sleep", "infinity"]

.devcontainer/devcontainer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"dockerComposeFile": ["../compose.yaml"],
44
"service": "dev",
55
"workspaceFolder": "/home/compiler/admin",
6+
"postAttachCommand": ["/bin/bash", ".devcontainer/postAttach.sh"],
67
"customizations": {
78
"vscode": {
89
// Set *default* container specific settings.json values on container create.

.devcontainer/postAttach.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
set -eu
3+
4+
pre-commit install --install-hooks

0 commit comments

Comments
 (0)