Skip to content

Commit 23a51e3

Browse files
Merge pull request #27 from NHSDigital/rossbugginsnhs/2024-07-03-prebuild-dev-container
Rossbugginsnhs/2024 07 03 prebuild dev container
2 parents f9b25cf + ff2b5a3 commit 23a51e3

File tree

11 files changed

+226
-80
lines changed

11 files changed

+226
-80
lines changed

.devcontainer/Dockerfile

Lines changed: 0 additions & 1 deletion
This file was deleted.

.devcontainer/devcontainer.json

Lines changed: 4 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
{
2-
"build": {
3-
"dockerfile": "Dockerfile"
4-
},
52
"customizations": {
63
"codespaces": {
74
"openFiles": [
@@ -13,11 +10,14 @@
1310
"vscode": {
1411
"extensions": [
1512
"alefragnani.bookmarks",
13+
"AmazonWebServices.aws-toolkit-vscode",
14+
"chdsbd.github-code-owners",
1615
"davidanson.vscode-markdownlint",
1716
"dbaeumer.vscode-eslint",
1817
"donjayamanne.githistory",
1918
"editorconfig.editorconfig",
2019
"esbenp.prettier-vscode",
20+
"fvclaus.sort-json-array",
2121
"github.codespaces",
2222
"github.github-vscode-theme",
2323
"github.remotehub",
@@ -59,44 +59,11 @@
5959
}
6060
}
6161
},
62-
"features": {
63-
"ghcr.io/devcontainers/features/aws-cli:1": {
64-
"version": "latest"
65-
},
66-
"ghcr.io/devcontainers/features/common-utils:2": {
67-
"configureZshAsDefaultShell": true,
68-
"installOhMyZsh": true,
69-
"installOhMyZshConfig": true,
70-
"installZsh": true,
71-
"upgradePackages": true,
72-
"userGid": "automatic",
73-
"userUid": "automatic",
74-
"username": "automatic"
75-
},
76-
"ghcr.io/devcontainers/features/docker-in-docker:2": {
77-
"azureDnsAutoDetection": true,
78-
"dockerDashComposeVersion": "latest",
79-
"installDockerBuildx": true,
80-
"installDockerComposeSwitch": true,
81-
"moby": true,
82-
"version": "latest"
83-
},
84-
"ghcr.io/devcontainers/features/github-cli:1": {
85-
"installDirectlyFromGitHubRelease": true,
86-
"version": "latest"
87-
},
88-
"ghcr.io/devcontainers/features/node:1": {
89-
"nodeGypDependencies": true,
90-
"nvmVersion": "latest",
91-
"version": "lts"
92-
}
93-
},
9462
"forwardPorts": [
9563
4000
9664
],
65+
"image": "ghcr.io/nhsdigital/nhs-notify-template-repository:latest",
9766
"name": "Jekyll",
98-
"postCreateCommand": "zsh scripts/devcontainer/postcreatecommand.sh",
99-
"postStartCommand": "zsh scripts/devcontainer/poststartcommand.sh",
10067
"runArgs": [
10168
"--platform=linux/amd64"
10269
]

nhs-notify-repository-template.code-workspace

Lines changed: 42 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,9 @@
3535
{
3636
"name": "Dev Container",
3737
"path": ".devcontainer"
38-
},
38+
}
3939
],
4040
"settings": {
41-
4241
"autoOpenWorkspace.enableAutoOpenIfSingleWorkspace": true,
4342
"githubCodeOwners.format.enabled": true,
4443
"workspace-terminals.switchTerminal": "always",
@@ -84,46 +83,50 @@
8483
"[json]": {
8584
"editor.wordWrap": "off",
8685
"editor.defaultFormatter": "esbenp.prettier-vscode"
87-
}
86+
},
87+
"window.title": "${separator}${activeRepositoryName}${separator}${activeRepositoryBranchName}${separator}[${remoteName}]",
88+
"window.titleSeparator": " : "
8889
},
8990
"extensions": {
9091
"recommendations": [
91-
"zoma.vscode-auto-open-workspace",
92-
"alefragnani.bookmarks",
93-
"davidanson.vscode-markdownlint",
94-
"dbaeumer.vscode-eslint",
95-
"donjayamanne.githistory",
96-
"eamodio.gitlens",
97-
"editorconfig.editorconfig",
98-
"esbenp.prettier-vscode",
99-
"github.codespaces",
100-
"github.github-vscode-theme",
101-
"github.remotehub",
102-
"github.vscode-github-actions",
103-
"github.vscode-pull-request-github",
104-
"hediet.vscode-drawio",
105-
"johnpapa.vscode-peacock",
106-
"mhutchie.git-graph",
107-
"ms-azuretools.vscode-docker",
108-
"ms-vscode-remote.remote-containers",
109-
"ms-vscode-remote.remote-wsl",
110-
"ms-vscode.hexeditor",
111-
"ms-vscode.live-server",
112-
"ms-vsliveshare.vsliveshare",
113-
"redhat.vscode-xml",
114-
"streetsidesoftware.code-spell-checker-british-english",
115-
"tamasfe.even-better-toml",
116-
"tomoki1207.pdf",
117-
"vscode-icons-team.vscode-icons",
118-
"vstirbu.vscode-mermaid-preview",
119-
"wayou.vscode-todo-highlight",
120-
"yzane.markdown-pdf",
121-
"yzhang.dictionary-completion",
122-
"yzhang.markdown-all-in-one",
123-
"joshx.workspace-terminals",
124-
"takumii.markdowntable",
125-
"chdsbd.github-code-owners"
126-
],
92+
"alefragnani.bookmarks",
93+
"AmazonWebServices.aws-toolkit-vscode",
94+
"chdsbd.github-code-owners",
95+
"davidanson.vscode-markdownlint",
96+
"dbaeumer.vscode-eslint",
97+
"donjayamanne.githistory",
98+
"editorconfig.editorconfig",
99+
"esbenp.prettier-vscode",
100+
"fvclaus.sort-json-array",
101+
"github.codespaces",
102+
"github.github-vscode-theme",
103+
"github.remotehub",
104+
"github.vscode-github-actions",
105+
"github.vscode-pull-request-github",
106+
"hediet.vscode-drawio",
107+
"johnpapa.vscode-peacock",
108+
"joshx.workspace-terminals",
109+
"maattdd.gitless",
110+
"mhutchie.git-graph",
111+
"ms-azuretools.vscode-docker",
112+
"ms-vscode-remote.remote-containers",
113+
"ms-vscode-remote.remote-wsl",
114+
"ms-vscode.hexeditor",
115+
"ms-vscode.live-server",
116+
"ms-vsliveshare.vsliveshare",
117+
"redhat.vscode-xml",
118+
"streetsidesoftware.code-spell-checker-british-english",
119+
"takumii.markdowntable",
120+
"tamasfe.even-better-toml",
121+
"tomoki1207.pdf",
122+
"vscode-icons-team.vscode-icons",
123+
"vstirbu.vscode-mermaid-preview",
124+
"wayou.vscode-todo-highlight",
125+
"yzane.markdown-pdf",
126+
"yzhang.dictionary-completion",
127+
"yzhang.markdown-all-in-one",
128+
"zoma.vscode-auto-open-workspace"
129+
],
127130
"unwantedRecommendations": []
128131
}
129132
}

src/Makefile

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/jekyll-devcontainer/Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
build:
2+
make -C ../../ Makefile version
3+
npm install -g @devcontainers/cli
4+
ver=$$(head -n 1 ../../.version 2> /dev/null || echo unknown); \
5+
verb=$$(echo $$ver | sed 's/\+.*//'); \
6+
echo "version: $$verb"; \
7+
BUILDKIT_PROGRESS=plain devcontainer build --workspace-folder ./src --image-name "ghcr.io/nhsdigital/nhs-notify-template-repository:$$verb"
8+
9+
publish:
10+
ver=$$(head -n 1 ../../.version 2> /dev/null || echo unknown); \
11+
verb=$$(echo $$ver | sed 's/\+.*//'); \
12+
echo "version: $$verb"; \
13+
docker image tag ghcr.io/nhsdigital/nhs-notify-template-repository:$$verb ghcr.io/nhsdigital/nhs-notify-template-repository:latest; \
14+
docker push "ghcr.io/nhsdigital/nhs-notify-template-repository:$$verb"; \
15+
docker push "ghcr.io/nhsdigital/nhs-notify-template-repository:latest"
16+
17+
debug:
18+
devcontainer up --workspace-folder ./src
19+
devcontainer exec --workspace-folder ./src ls -la

src/jekyll-devcontainer/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Publishing
2+
3+
To publish, create classic and docker login before `make publish`
4+
5+
Docker login:
6+
7+
```bash
8+
export CR_PAT=YOUR_TOKEN
9+
echo $CR_PAT | docker login ghcr.io -u USERNAME --password-stdin
10+
```
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
FROM --platform=linux/amd64 mcr.microsoft.com/devcontainers/jekyll:2-bullseye
2+
LABEL org.opencontainers.image.source=https://github.com/NHSDigital/nhs-notify-repository-template
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
{
2+
"build": {
3+
"dockerfile": "Dockerfile"
4+
},
5+
"customizations": {
6+
"codespaces": {
7+
"openFiles": [
8+
"README.md",
9+
".github/SECURITY.md",
10+
"docs/index.md"
11+
]
12+
},
13+
"vscode": {
14+
"extensions": [
15+
"alefragnani.bookmarks",
16+
"AmazonWebServices.aws-toolkit-vscode",
17+
"chdsbd.github-code-owners",
18+
"davidanson.vscode-markdownlint",
19+
"dbaeumer.vscode-eslint",
20+
"donjayamanne.githistory",
21+
"editorconfig.editorconfig",
22+
"esbenp.prettier-vscode",
23+
"fvclaus.sort-json-array",
24+
"github.codespaces",
25+
"github.github-vscode-theme",
26+
"github.remotehub",
27+
"github.vscode-github-actions",
28+
"github.vscode-pull-request-github",
29+
"hediet.vscode-drawio",
30+
"johnpapa.vscode-peacock",
31+
"joshx.workspace-terminals",
32+
"maattdd.gitless",
33+
"mhutchie.git-graph",
34+
"ms-azuretools.vscode-docker",
35+
"ms-vscode-remote.remote-containers",
36+
"ms-vscode-remote.remote-wsl",
37+
"ms-vscode.hexeditor",
38+
"ms-vscode.live-server",
39+
"ms-vsliveshare.vsliveshare",
40+
"redhat.vscode-xml",
41+
"streetsidesoftware.code-spell-checker-british-english",
42+
"takumii.markdowntable",
43+
"tamasfe.even-better-toml",
44+
"tomoki1207.pdf",
45+
"vscode-icons-team.vscode-icons",
46+
"vstirbu.vscode-mermaid-preview",
47+
"wayou.vscode-todo-highlight",
48+
"yzane.markdown-pdf",
49+
"yzhang.dictionary-completion",
50+
"yzhang.markdown-all-in-one",
51+
"zoma.vscode-auto-open-workspace"
52+
],
53+
"settings": {
54+
"[makefile]": {
55+
"editor.detectIndentation": false,
56+
"editor.insertSpaces": false
57+
},
58+
"autoOpenWorkspace.enableAutoOpenIfSingleWorkspace": true,
59+
"editor.formatOnSave": true,
60+
"extensions.ignoreRecommendations": true,
61+
"files.insertFinalNewline": true
62+
}
63+
}
64+
},
65+
"features": {
66+
"./nhsnotify": {},
67+
"ghcr.io/devcontainers/features/aws-cli:1": {
68+
"version": "latest"
69+
},
70+
"ghcr.io/devcontainers/features/common-utils:2": {
71+
"configureZshAsDefaultShell": true,
72+
"installOhMyZsh": true,
73+
"installOhMyZshConfig": true,
74+
"installZsh": true,
75+
"upgradePackages": true,
76+
"userGid": "automatic",
77+
"userUid": "automatic",
78+
"username": "automatic"
79+
},
80+
"ghcr.io/devcontainers/features/docker-in-docker:2": {
81+
"azureDnsAutoDetection": true,
82+
"dockerDashComposeVersion": "latest",
83+
"installDockerBuildx": true,
84+
"installDockerComposeSwitch": true,
85+
"moby": true,
86+
"version": "latest"
87+
},
88+
"ghcr.io/devcontainers/features/github-cli:1": {
89+
"installDirectlyFromGitHubRelease": true,
90+
"version": "latest"
91+
},
92+
"ghcr.io/devcontainers/features/node:1": {
93+
"nodeGypDependencies": true,
94+
"nvmVersion": "latest",
95+
"version": "lts"
96+
}
97+
},
98+
"forwardPorts": [
99+
4000
100+
],
101+
"name": "NHS Notify Default Dev Container",
102+
"runArgs": [
103+
"--platform=linux/amd64"
104+
]
105+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"dependsOn": {
3+
"ghcr.io/devcontainers/features/common-utils:2": {
4+
"installOhMyZsh": true
5+
}
6+
},
7+
"id": "nhsnotify",
8+
"name": "Notify Custom",
9+
"postCreateCommand": "zsh /postcreatecommand.sh",
10+
"version": "1.0.0"
11+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
cp ./postcreatecommand.sh /postcreatecommand.sh
4+
5+
cp ~/.zshrc /.zshrc
6+
rm -Rf /.asdf
7+
git clone https://github.com/asdf-vm/asdf.git /.asdf;
8+
chmod +x /.asdf/asdf.sh;
9+
echo '. /.asdf/asdf.sh' >> /.zshrc
10+
echo '. /.asdf/completions/asdf.bash' >> /.zshrc
11+
sed -i "/plugins=/c\plugins=(git ssh-agent sudo terraform dirhistory zsh-autosuggestions)" /.zshrc
12+
13+
cat /.zshrc
14+
15+
cp /.zshrc ~/.zshrc
16+
source ~/.zshrc
17+
mkdir -p /zsh/plugins/zsh-autosuggestions
18+
git clone https://github.com/zsh-users/zsh-autosuggestions /zsh/plugins/zsh-autosuggestions

0 commit comments

Comments
 (0)