Skip to content

Commit

Permalink
Add devcontainer to improve developer experience for contributors (#3942
Browse files Browse the repository at this point in the history
)

* 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>
  • Loading branch information
3 people authored Jan 11, 2024
1 parent 2602ab4 commit 946c2c8
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 15 deletions.
36 changes: 36 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -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 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* text=auto eol=lf
*.{cmd,[cC][mM][dD]} text eol=crlf
*.{bat,[bB][aA][tT]} text eol=crlf
52 changes: 37 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

- [Hugo extended version](https://gohugo.io/getting-started/installing)
- [Node.js](https://nodejs.org/en/)
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

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

1. Ensure pre-requisites are installed
2. Clone this repository
### Environment setup

1. [Fork](https://github.com/dapr/docs/fork) and clone this repository.

1. Open the forked repository in VS Code

```sh
git clone https://github.com/dapr/docs.git
code .
```

3. Change to daprdocs directory:
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

1. Ensure pre-requisites are installed.
1. [Fork](https://github.com/dapr/docs/fork) and clone this repository.

1. Change to daprdocs directory:

```sh
cd ./daprdocs
Expand All @@ -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
Expand All @@ -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

Expand Down
4 changes: 4 additions & 0 deletions scripts/init-container.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
git config --global --add safe.directory '*'
cd ./daprdocs
git submodule update --init --recursive
npm install

0 comments on commit 946c2c8

Please sign in to comment.