Skip to content

Commit 946c2c8

Browse files
marcduikermsfussellhhunter-ms
authored
Add devcontainer to improve developer experience for contributors (dapr#3942)
* Add devcontainer with Hugo Signed-off-by: Marc Duiker <[email protected]> * Add Node and install script Signed-off-by: Marc Duiker <[email protected]> * Update README with devcontainer Signed-off-by: Marc Duiker <[email protected]> * Add . Signed-off-by: Marc Duiker <[email protected]> * Update README.md Co-authored-by: Mark Fussell <[email protected]> Signed-off-by: Marc Duiker <[email protected]> * Increment step numbers Signed-off-by: Marc Duiker <[email protected]> * Clarify devcontainer in other IDEs Signed-off-by: Marc Duiker <[email protected]> * revert back to old numbering Co-authored-by: Hannah Hunter <[email protected]> Signed-off-by: Marc Duiker <[email protected]> * revert back to old numbering Co-authored-by: Hannah Hunter <[email protected]> Signed-off-by: Marc Duiker <[email protected]> * revert back to old numbering Co-authored-by: Hannah Hunter <[email protected]> Signed-off-by: Marc Duiker <[email protected]> * revert back to old numbering Co-authored-by: Hannah Hunter <[email protected]> Signed-off-by: Marc Duiker <[email protected]> --------- Signed-off-by: Marc Duiker <[email protected]> Co-authored-by: Mark Fussell <[email protected]> Co-authored-by: Hannah Hunter <[email protected]>
1 parent 2602ab4 commit 946c2c8

File tree

4 files changed

+80
-15
lines changed

4 files changed

+80
-15
lines changed

.devcontainer/devcontainer.json

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
3+
{
4+
"name": "Ubuntu",
5+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6+
"image": "mcr.microsoft.com/devcontainers/base:jammy",
7+
"features": {
8+
"ghcr.io/devcontainers/features/go:1": {
9+
"version": "latest"
10+
},
11+
"ghcr.io/devcontainers/features/hugo:1": {
12+
"extended": true,
13+
"version": "latest"
14+
},
15+
"ghcr.io/devcontainers/features/node:1": {
16+
"nodeGypDependencies": true,
17+
"version": "lts",
18+
"nvmVersion": "latest"
19+
}
20+
},
21+
"customizations": {
22+
"vscode": {
23+
"extensions": [
24+
"streetsidesoftware.code-spell-checker",
25+
"tamasfe.even-better-toml",
26+
"davidanson.vscode-markdownlint",
27+
"budparr.language-hugo-vscode"
28+
],
29+
"settings": {
30+
"git.alwaysSignOff": true
31+
}
32+
}
33+
},
34+
"forwardPorts": [1313],
35+
"postAttachCommand": "bash scripts/init-container.sh"
36+
}

.gitattributes

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

README.md

+37-15
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,44 @@ The Dapr docs are built using [Hugo](https://gohugo.io/) with the [Docsy](https:
2929

3030
The [daprdocs](./daprdocs) directory contains the hugo project, markdown files, and theme configurations.
3131

32-
## Pre-requisites
32+
## Setup with a devcontainer
3333

34-
- [Hugo extended version](https://gohugo.io/getting-started/installing)
35-
- [Node.js](https://nodejs.org/en/)
34+
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.
35+
36+
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.
37+
38+
### Pre-requisites
3639

37-
## Environment setup
40+
- [Docker Desktop](https://www.docker.com/products/docker-desktop)
41+
- [VSCode](https://code.visualstudio.com/download)
3842

39-
1. Ensure pre-requisites are installed
40-
2. Clone this repository
43+
### Environment setup
44+
45+
1. [Fork](https://github.com/dapr/docs/fork) and clone this repository.
46+
47+
1. Open the forked repository in VS Code
4148

4249
```sh
43-
git clone https://github.com/dapr/docs.git
50+
code .
4451
```
4552

46-
3. Change to daprdocs directory:
53+
1. When prompted, click "Reopen in Container" to open the repository in the devcontainer.
54+
55+
Continue with the [Run local server](#run-local-server) steps.
56+
57+
## Setup without a devcontainer
58+
59+
### Pre-requisites
60+
61+
- [Hugo extended version](https://gohugo.io/getting-started/installing)
62+
- [Node.js](https://nodejs.org/en/)
63+
64+
### Environment setup
65+
66+
1. Ensure pre-requisites are installed.
67+
1. [Fork](https://github.com/dapr/docs/fork) and clone this repository.
68+
69+
1. Change to daprdocs directory:
4770

4871
```sh
4972
cd ./daprdocs
@@ -63,7 +86,7 @@ npm install
6386

6487
## Run local server
6588

66-
1. Make sure you're still in the `daprdocs` directory
89+
1. Make sure you're in the `daprdocs` directory
6790
2. Run
6891

6992
```sh
@@ -72,14 +95,13 @@ hugo server
7295

7396
3. Navigate to `http://localhost:1313/`
7497

75-
7698
## Update docs
7799

78-
1. Fork repo into your account
79-
1. Create new branch
80-
1. Commit and push changes to forked branch
81-
1. Submit pull request from downstream branch to the upstream branch for the correct version you are targeting
82-
1. Staging site will automatically get created and linked to PR to review and test
100+
1. Ensure you are in your forked repo
101+
2. Create new branch
102+
3. Commit and push changes to forked branch
103+
4. Submit pull request from downstream branch to the upstream branch for the correct version you are targeting
104+
5. Staging site will automatically get created and linked to PR to review and test
83105

84106
## Code of Conduct
85107

scripts/init-container.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
git config --global --add safe.directory '*'
2+
cd ./daprdocs
3+
git submodule update --init --recursive
4+
npm install

0 commit comments

Comments
 (0)