Skip to content

Commit 9173912

Browse files
committed
chore: add lifecycle scripts to base container
1 parent 866bbca commit 9173912

5 files changed

Lines changed: 15 additions & 1 deletion

File tree

.devcontainer/devcontainer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
"--network=host"
2323
],
2424
"remoteEnv": { "LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}" },
25-
"postCreateCommand": "bash .devcontainer/../scripts/install-git-secrets.sh",
25+
"postCreateCommand": "bash ${SCRIPTS_DIR}/postCreate.sh",
26+
"postStartCommand": "bash ${SCRIPTS_DIR}/postStart.sh",
27+
"postAttachCommand": "bash ${SCRIPTS_DIR}/postAttach.sh",
2628
"features": {
2729
},
2830
"customizations": {

src/base/.devcontainer/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ ENV CONTAINER_NAME=${CONTAINER_NAME}
2121
ENV TARGETARCH=${TARGETARCH}
2222

2323
COPY .tool-versions.asdf ${SCRIPTS_DIR}/${CONTAINER_NAME}/.tool-versions.asdf
24+
COPY --chmod=755 scripts/lifecycle/*.sh ${SCRIPTS_DIR}/
2425
COPY --chmod=755 scripts/root_install.sh ${SCRIPTS_DIR}/${CONTAINER_NAME}/root_install.sh
2526
COPY --chmod=755 Mk ${SCRIPTS_DIR}/Mk
2627

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
# Script to run as devcontainer postAttachCommand
3+
4+
# currently empty

scripts/install-git-secrets.sh renamed to src/base/.devcontainer/scripts/lifecycle/post_create.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#!/bin/bash
2+
# Script to run as devcontainer postCreateCommand
3+
4+
# Install git-secrets, register AWS patterns and NHS rules in an idempotent way
25
if ! git config --get-all secrets.patterns | grep -Fq AKIA; then
36
git-secrets --register-aws
47
fi
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
# Script to run as devcontainer postStartCommand
3+
4+
# currently empty

0 commit comments

Comments
 (0)