Add devcontainer to improve developer experience for contributors (#3942)

* Add devcontainer with Hugo

Signed-off-by: Marc Duiker <marcduiker@users.noreply.github.com>

* Add Node and install script

Signed-off-by: Marc Duiker <marcduiker@users.noreply.github.com>

* Update README with devcontainer

Signed-off-by: Marc Duiker <marcduiker@users.noreply.github.com>

* Add .

Signed-off-by: Marc Duiker <marcduiker@users.noreply.github.com>

* Update README.md

Co-authored-by: Mark Fussell <markfussell@gmail.com>
Signed-off-by: Marc Duiker <marcduiker@users.noreply.github.com>

* Increment step numbers

Signed-off-by: Marc Duiker <marcduiker@users.noreply.github.com>

* Clarify devcontainer in other IDEs

Signed-off-by: Marc Duiker <marcduiker@users.noreply.github.com>

* revert back to old numbering

Co-authored-by: Hannah Hunter <94493363+hhunter-ms@users.noreply.github.com>
Signed-off-by: Marc Duiker <marcduiker@users.noreply.github.com>

* revert back to old numbering

Co-authored-by: Hannah Hunter <94493363+hhunter-ms@users.noreply.github.com>
Signed-off-by: Marc Duiker <marcduiker@users.noreply.github.com>

* revert back to old numbering

Co-authored-by: Hannah Hunter <94493363+hhunter-ms@users.noreply.github.com>
Signed-off-by: Marc Duiker <marcduiker@users.noreply.github.com>

* revert back to old numbering

Co-authored-by: Hannah Hunter <94493363+hhunter-ms@users.noreply.github.com>
Signed-off-by: Marc Duiker <marcduiker@users.noreply.github.com>

---------

Signed-off-by: Marc Duiker <marcduiker@users.noreply.github.com>
Co-authored-by: Mark Fussell <markfussell@gmail.com>
Co-authored-by: Hannah Hunter <94493363+hhunter-ms@users.noreply.github.com>
This commit is contained in:
Marc Duiker 2024-01-11 06:37:32 +01:00 committed by GitHub
parent 2602ab4216
commit 946c2c8b61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 81 additions and 16 deletions

View File

@ -0,0 +1,36 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
{
"name": "Ubuntu",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/base:jammy",
"features": {
"ghcr.io/devcontainers/features/go:1": {
"version": "latest"
},
"ghcr.io/devcontainers/features/hugo:1": {
"extended": true,
"version": "latest"
},
"ghcr.io/devcontainers/features/node:1": {
"nodeGypDependencies": true,
"version": "lts",
"nvmVersion": "latest"
}
},
"customizations": {
"vscode": {
"extensions": [
"streetsidesoftware.code-spell-checker",
"tamasfe.even-better-toml",
"davidanson.vscode-markdownlint",
"budparr.language-hugo-vscode"
],
"settings": {
"git.alwaysSignOff": true
}
}
},
"forwardPorts": [1313],
"postAttachCommand": "bash scripts/init-container.sh"
}

3
.gitattributes vendored Normal file
View File

@ -0,0 +1,3 @@
* text=auto eol=lf
*.{cmd,[cC][mM][dD]} text eol=crlf
*.{bat,[bB][aA][tT]} text eol=crlf

View File

@ -29,21 +29,44 @@ The Dapr docs are built using [Hugo](https://gohugo.io/) with the [Docsy](https:
The [daprdocs](./daprdocs) directory contains the hugo project, markdown files, and theme configurations.
## Pre-requisites
## Setup with a devcontainer
This repository comes with a [devcontainer](/.devcontainer/devcontainer.json) configuration that automatically installs all the required dependencies and VSCode extensions to build and run the docs.
This devcontainer can be used to develop locally with VSCode or via GitHub Codespaces completely in the browser. Other IDEs that support [devcontainers](https://containers.dev/) can be used but won't have the extensions preconfigured and will likely have different performance characteristics.
### Pre-requisites
- [Docker Desktop](https://www.docker.com/products/docker-desktop)
- [VSCode](https://code.visualstudio.com/download)
### Environment setup
1. [Fork](https://github.com/dapr/docs/fork) and clone this repository.
1. Open the forked repository in VS Code
```sh
code .
```
1. When prompted, click "Reopen in Container" to open the repository in the devcontainer.
Continue with the [Run local server](#run-local-server) steps.
## Setup without a devcontainer
### Pre-requisites
- [Hugo extended version](https://gohugo.io/getting-started/installing)
- [Node.js](https://nodejs.org/en/)
## Environment setup
### Environment setup
1. Ensure pre-requisites are installed
2. Clone this repository
1. Ensure pre-requisites are installed.
1. [Fork](https://github.com/dapr/docs/fork) and clone this repository.
```sh
git clone https://github.com/dapr/docs.git
```
3. Change to daprdocs directory:
1. Change to daprdocs directory:
```sh
cd ./daprdocs
@ -63,7 +86,7 @@ npm install
## Run local server
1. Make sure you're still in the `daprdocs` directory
1. Make sure you're in the `daprdocs` directory
2. Run
```sh
@ -72,14 +95,13 @@ hugo server
3. Navigate to `http://localhost:1313/`
## Update docs
1. Fork repo into your account
1. Create new branch
1. Commit and push changes to forked branch
1. Submit pull request from downstream branch to the upstream branch for the correct version you are targeting
1. Staging site will automatically get created and linked to PR to review and test
1. Ensure you are in your forked repo
2. Create new branch
3. Commit and push changes to forked branch
4. Submit pull request from downstream branch to the upstream branch for the correct version you are targeting
5. Staging site will automatically get created and linked to PR to review and test
## Code of Conduct

View File

@ -0,0 +1,4 @@
git config --global --add safe.directory '*'
cd ./daprdocs
git submodule update --init --recursive
npm install