diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile deleted file mode 100644 index dc38297..0000000 --- a/.devcontainer/Dockerfile +++ /dev/null @@ -1 +0,0 @@ -FROM --platform=linux/amd64 mcr.microsoft.com/devcontainers/jekyll:2-bullseye diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 0d24b16..c4ebb00 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,7 +1,4 @@ { - "build": { - "dockerfile": "Dockerfile" - }, "customizations": { "codespaces": { "openFiles": [ @@ -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", @@ -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" ] diff --git a/nhs-notify-repository-template.code-workspace b/nhs-notify-repository-template.code-workspace index 1d6f990..a52565d 100644 --- a/nhs-notify-repository-template.code-workspace +++ b/nhs-notify-repository-template.code-workspace @@ -35,10 +35,9 @@ { "name": "Dev Container", "path": ".devcontainer" - }, + } ], "settings": { - "autoOpenWorkspace.enableAutoOpenIfSingleWorkspace": true, "githubCodeOwners.format.enabled": true, "workspace-terminals.switchTerminal": "always", @@ -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": [] } } diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index ccfdd5c..0000000 --- a/src/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -build: - -publish: diff --git a/src/jekyll-devcontainer/Makefile b/src/jekyll-devcontainer/Makefile new file mode 100644 index 0000000..f295ce0 --- /dev/null +++ b/src/jekyll-devcontainer/Makefile @@ -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 diff --git a/src/jekyll-devcontainer/README.md b/src/jekyll-devcontainer/README.md new file mode 100644 index 0000000..99b63a3 --- /dev/null +++ b/src/jekyll-devcontainer/README.md @@ -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 +``` diff --git a/src/jekyll-devcontainer/src/.devcontainer/Dockerfile b/src/jekyll-devcontainer/src/.devcontainer/Dockerfile new file mode 100644 index 0000000..17fd968 --- /dev/null +++ b/src/jekyll-devcontainer/src/.devcontainer/Dockerfile @@ -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 diff --git a/src/jekyll-devcontainer/src/.devcontainer/devcontainer.json b/src/jekyll-devcontainer/src/.devcontainer/devcontainer.json new file mode 100644 index 0000000..26d7357 --- /dev/null +++ b/src/jekyll-devcontainer/src/.devcontainer/devcontainer.json @@ -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" + ] +} diff --git a/src/jekyll-devcontainer/src/.devcontainer/nhsnotify/devcontainer-feature.json b/src/jekyll-devcontainer/src/.devcontainer/nhsnotify/devcontainer-feature.json new file mode 100644 index 0000000..f79300c --- /dev/null +++ b/src/jekyll-devcontainer/src/.devcontainer/nhsnotify/devcontainer-feature.json @@ -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" +} diff --git a/src/jekyll-devcontainer/src/.devcontainer/nhsnotify/install.sh b/src/jekyll-devcontainer/src/.devcontainer/nhsnotify/install.sh new file mode 100755 index 0000000..56f481a --- /dev/null +++ b/src/jekyll-devcontainer/src/.devcontainer/nhsnotify/install.sh @@ -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 diff --git a/src/jekyll-devcontainer/src/.devcontainer/nhsnotify/postcreatecommand.sh b/src/jekyll-devcontainer/src/.devcontainer/nhsnotify/postcreatecommand.sh new file mode 100755 index 0000000..a844efd --- /dev/null +++ b/src/jekyll-devcontainer/src/.devcontainer/nhsnotify/postcreatecommand.sh @@ -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'