Skip to content

Commit

Permalink
Merge pull request #27 from NHSDigital/rossbugginsnhs/2024-07-03-preb…
Browse files Browse the repository at this point in the history
…uild-dev-container

Rossbugginsnhs/2024 07 03 prebuild dev container
  • Loading branch information
RossBugginsNHS authored Jul 3, 2024
2 parents f9b25cf + ff2b5a3 commit 23a51e3
Show file tree
Hide file tree
Showing 11 changed files with 226 additions and 80 deletions.
1 change: 0 additions & 1 deletion .devcontainer/Dockerfile

This file was deleted.

41 changes: 4 additions & 37 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
"build": {
"dockerfile": "Dockerfile"
},
"customizations": {
"codespaces": {
"openFiles": [
Expand All @@ -13,11 +10,14 @@
"vscode": {
"extensions": [
"alefragnani.bookmarks",
"AmazonWebServices.aws-toolkit-vscode",
"chdsbd.github-code-owners",
"davidanson.vscode-markdownlint",
"dbaeumer.vscode-eslint",
"donjayamanne.githistory",
"editorconfig.editorconfig",
"esbenp.prettier-vscode",
"fvclaus.sort-json-array",
"github.codespaces",
"github.github-vscode-theme",
"github.remotehub",
Expand Down Expand Up @@ -59,44 +59,11 @@
}
}
},
"features": {
"ghcr.io/devcontainers/features/aws-cli:1": {
"version": "latest"
},
"ghcr.io/devcontainers/features/common-utils:2": {
"configureZshAsDefaultShell": true,
"installOhMyZsh": true,
"installOhMyZshConfig": true,
"installZsh": true,
"upgradePackages": true,
"userGid": "automatic",
"userUid": "automatic",
"username": "automatic"
},
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"azureDnsAutoDetection": true,
"dockerDashComposeVersion": "latest",
"installDockerBuildx": true,
"installDockerComposeSwitch": true,
"moby": true,
"version": "latest"
},
"ghcr.io/devcontainers/features/github-cli:1": {
"installDirectlyFromGitHubRelease": true,
"version": "latest"
},
"ghcr.io/devcontainers/features/node:1": {
"nodeGypDependencies": true,
"nvmVersion": "latest",
"version": "lts"
}
},
"forwardPorts": [
4000
],
"image": "ghcr.io/nhsdigital/nhs-notify-template-repository:latest",
"name": "Jekyll",
"postCreateCommand": "zsh scripts/devcontainer/postcreatecommand.sh",
"postStartCommand": "zsh scripts/devcontainer/poststartcommand.sh",
"runArgs": [
"--platform=linux/amd64"
]
Expand Down
81 changes: 42 additions & 39 deletions nhs-notify-repository-template.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@
{
"name": "Dev Container",
"path": ".devcontainer"
},
}
],
"settings": {

"autoOpenWorkspace.enableAutoOpenIfSingleWorkspace": true,
"githubCodeOwners.format.enabled": true,
"workspace-terminals.switchTerminal": "always",
Expand Down Expand Up @@ -84,46 +83,50 @@
"[json]": {
"editor.wordWrap": "off",
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
},
"window.title": "${separator}${activeRepositoryName}${separator}${activeRepositoryBranchName}${separator}[${remoteName}]",
"window.titleSeparator": " : "
},
"extensions": {
"recommendations": [
"zoma.vscode-auto-open-workspace",
"alefragnani.bookmarks",
"davidanson.vscode-markdownlint",
"dbaeumer.vscode-eslint",
"donjayamanne.githistory",
"eamodio.gitlens",
"editorconfig.editorconfig",
"esbenp.prettier-vscode",
"github.codespaces",
"github.github-vscode-theme",
"github.remotehub",
"github.vscode-github-actions",
"github.vscode-pull-request-github",
"hediet.vscode-drawio",
"johnpapa.vscode-peacock",
"mhutchie.git-graph",
"ms-azuretools.vscode-docker",
"ms-vscode-remote.remote-containers",
"ms-vscode-remote.remote-wsl",
"ms-vscode.hexeditor",
"ms-vscode.live-server",
"ms-vsliveshare.vsliveshare",
"redhat.vscode-xml",
"streetsidesoftware.code-spell-checker-british-english",
"tamasfe.even-better-toml",
"tomoki1207.pdf",
"vscode-icons-team.vscode-icons",
"vstirbu.vscode-mermaid-preview",
"wayou.vscode-todo-highlight",
"yzane.markdown-pdf",
"yzhang.dictionary-completion",
"yzhang.markdown-all-in-one",
"joshx.workspace-terminals",
"takumii.markdowntable",
"chdsbd.github-code-owners"
],
"alefragnani.bookmarks",
"AmazonWebServices.aws-toolkit-vscode",
"chdsbd.github-code-owners",
"davidanson.vscode-markdownlint",
"dbaeumer.vscode-eslint",
"donjayamanne.githistory",
"editorconfig.editorconfig",
"esbenp.prettier-vscode",
"fvclaus.sort-json-array",
"github.codespaces",
"github.github-vscode-theme",
"github.remotehub",
"github.vscode-github-actions",
"github.vscode-pull-request-github",
"hediet.vscode-drawio",
"johnpapa.vscode-peacock",
"joshx.workspace-terminals",
"maattdd.gitless",
"mhutchie.git-graph",
"ms-azuretools.vscode-docker",
"ms-vscode-remote.remote-containers",
"ms-vscode-remote.remote-wsl",
"ms-vscode.hexeditor",
"ms-vscode.live-server",
"ms-vsliveshare.vsliveshare",
"redhat.vscode-xml",
"streetsidesoftware.code-spell-checker-british-english",
"takumii.markdowntable",
"tamasfe.even-better-toml",
"tomoki1207.pdf",
"vscode-icons-team.vscode-icons",
"vstirbu.vscode-mermaid-preview",
"wayou.vscode-todo-highlight",
"yzane.markdown-pdf",
"yzhang.dictionary-completion",
"yzhang.markdown-all-in-one",
"zoma.vscode-auto-open-workspace"
],
"unwantedRecommendations": []
}
}
3 changes: 0 additions & 3 deletions src/Makefile

This file was deleted.

19 changes: 19 additions & 0 deletions src/jekyll-devcontainer/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
build:
make -C ../../ Makefile version
npm install -g @devcontainers/cli
ver=$$(head -n 1 ../../.version 2> /dev/null || echo unknown); \
verb=$$(echo $$ver | sed 's/\+.*//'); \
echo "version: $$verb"; \
BUILDKIT_PROGRESS=plain devcontainer build --workspace-folder ./src --image-name "ghcr.io/nhsdigital/nhs-notify-template-repository:$$verb"

publish:
ver=$$(head -n 1 ../../.version 2> /dev/null || echo unknown); \
verb=$$(echo $$ver | sed 's/\+.*//'); \
echo "version: $$verb"; \
docker image tag ghcr.io/nhsdigital/nhs-notify-template-repository:$$verb ghcr.io/nhsdigital/nhs-notify-template-repository:latest; \
docker push "ghcr.io/nhsdigital/nhs-notify-template-repository:$$verb"; \
docker push "ghcr.io/nhsdigital/nhs-notify-template-repository:latest"

debug:
devcontainer up --workspace-folder ./src
devcontainer exec --workspace-folder ./src ls -la
10 changes: 10 additions & 0 deletions src/jekyll-devcontainer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Publishing

To publish, create classic and docker login before `make publish`

Docker login:

```bash
export CR_PAT=YOUR_TOKEN
echo $CR_PAT | docker login ghcr.io -u USERNAME --password-stdin
```
2 changes: 2 additions & 0 deletions src/jekyll-devcontainer/src/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM --platform=linux/amd64 mcr.microsoft.com/devcontainers/jekyll:2-bullseye
LABEL org.opencontainers.image.source=https://github.com/NHSDigital/nhs-notify-repository-template
105 changes: 105 additions & 0 deletions src/jekyll-devcontainer/src/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
{
"build": {
"dockerfile": "Dockerfile"
},
"customizations": {
"codespaces": {
"openFiles": [
"README.md",
".github/SECURITY.md",
"docs/index.md"
]
},
"vscode": {
"extensions": [
"alefragnani.bookmarks",
"AmazonWebServices.aws-toolkit-vscode",
"chdsbd.github-code-owners",
"davidanson.vscode-markdownlint",
"dbaeumer.vscode-eslint",
"donjayamanne.githistory",
"editorconfig.editorconfig",
"esbenp.prettier-vscode",
"fvclaus.sort-json-array",
"github.codespaces",
"github.github-vscode-theme",
"github.remotehub",
"github.vscode-github-actions",
"github.vscode-pull-request-github",
"hediet.vscode-drawio",
"johnpapa.vscode-peacock",
"joshx.workspace-terminals",
"maattdd.gitless",
"mhutchie.git-graph",
"ms-azuretools.vscode-docker",
"ms-vscode-remote.remote-containers",
"ms-vscode-remote.remote-wsl",
"ms-vscode.hexeditor",
"ms-vscode.live-server",
"ms-vsliveshare.vsliveshare",
"redhat.vscode-xml",
"streetsidesoftware.code-spell-checker-british-english",
"takumii.markdowntable",
"tamasfe.even-better-toml",
"tomoki1207.pdf",
"vscode-icons-team.vscode-icons",
"vstirbu.vscode-mermaid-preview",
"wayou.vscode-todo-highlight",
"yzane.markdown-pdf",
"yzhang.dictionary-completion",
"yzhang.markdown-all-in-one",
"zoma.vscode-auto-open-workspace"
],
"settings": {
"[makefile]": {
"editor.detectIndentation": false,
"editor.insertSpaces": false
},
"autoOpenWorkspace.enableAutoOpenIfSingleWorkspace": true,
"editor.formatOnSave": true,
"extensions.ignoreRecommendations": true,
"files.insertFinalNewline": true
}
}
},
"features": {
"./nhsnotify": {},
"ghcr.io/devcontainers/features/aws-cli:1": {
"version": "latest"
},
"ghcr.io/devcontainers/features/common-utils:2": {
"configureZshAsDefaultShell": true,
"installOhMyZsh": true,
"installOhMyZshConfig": true,
"installZsh": true,
"upgradePackages": true,
"userGid": "automatic",
"userUid": "automatic",
"username": "automatic"
},
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"azureDnsAutoDetection": true,
"dockerDashComposeVersion": "latest",
"installDockerBuildx": true,
"installDockerComposeSwitch": true,
"moby": true,
"version": "latest"
},
"ghcr.io/devcontainers/features/github-cli:1": {
"installDirectlyFromGitHubRelease": true,
"version": "latest"
},
"ghcr.io/devcontainers/features/node:1": {
"nodeGypDependencies": true,
"nvmVersion": "latest",
"version": "lts"
}
},
"forwardPorts": [
4000
],
"name": "NHS Notify Default Dev Container",
"runArgs": [
"--platform=linux/amd64"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"dependsOn": {
"ghcr.io/devcontainers/features/common-utils:2": {
"installOhMyZsh": true
}
},
"id": "nhsnotify",
"name": "Notify Custom",
"postCreateCommand": "zsh /postcreatecommand.sh",
"version": "1.0.0"
}
18 changes: 18 additions & 0 deletions src/jekyll-devcontainer/src/.devcontainer/nhsnotify/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

cp ./postcreatecommand.sh /postcreatecommand.sh

cp ~/.zshrc /.zshrc
rm -Rf /.asdf
git clone https://github.com/asdf-vm/asdf.git /.asdf;
chmod +x /.asdf/asdf.sh;
echo '. /.asdf/asdf.sh' >> /.zshrc
echo '. /.asdf/completions/asdf.bash' >> /.zshrc
sed -i "/plugins=/c\plugins=(git ssh-agent sudo terraform dirhistory zsh-autosuggestions)" /.zshrc

cat /.zshrc

cp /.zshrc ~/.zshrc
source ~/.zshrc
mkdir -p /zsh/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions /zsh/plugins/zsh-autosuggestions
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

cp /.zshrc ~/.zshrc
cp -r /zsh/* ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}
ls -la ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}

cat ~/.zshrc
source ~/.zshrc
echo 'asdf setup complete'

make config
echo 'make config complete'

jekyll --version && cd docs && bundle install
echo 'jekyll setup complete'

0 comments on commit 23a51e3

Please sign in to comment.