Skip to content

Commit 256a8c8

Browse files
author
Slava Katiukha
committed
Add .devcontainer configuration files and VS Code tasks.json
1 parent 729642e commit 256a8c8

File tree

7 files changed

+135
-20
lines changed

7 files changed

+135
-20
lines changed

.devcontainer/Dockerfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM jetpackio/devbox:latest
2+
3+
# Installing your devbox project
4+
WORKDIR /code
5+
USER root:root
6+
RUN mkdir -p /code && chown ${DEVBOX_USER}:${DEVBOX_USER} /code
7+
USER ${DEVBOX_USER}:${DEVBOX_USER}
8+
9+
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} 3rdparty ./3rdparty
10+
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} plugins ./plugins
11+
12+
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} devbox.json devbox.json
13+
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} devbox.lock devbox.lock
14+
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} Pipfile Pipfile$
15+
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} Pipfile.lock Pipfile.lock
16+
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} Taskfile.yaml Taskfile.yaml
17+
18+
RUN devbox run -- echo "Installed Packages."
19+
RUN devbox shellenv --init-hook >> ~/.profile

.devcontainer/devcontainer.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "Devbox Remote Container",
3+
"build": {
4+
"dockerfile": "./Dockerfile",
5+
"context": ".."
6+
},
7+
"customizations": {
8+
"vscode": {
9+
"settings": {},
10+
"extensions": [
11+
"jetpack-io.devbox"
12+
]
13+
}
14+
},
15+
"remoteUser": "devbox"
16+
}

.vscode/tasks.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "Start the Docs web server",
8+
"type": "shell",
9+
"osx": {
10+
"command": "command -v devbox &> /dev/null || (curl -fsSL https://get.jetpack.io/devbox | bash) && devbox run serve"
11+
},
12+
"linux": {
13+
"command": "command -v devbox &> /dev/null || (curl -fsSL https://get.jetpack.io/devbox | bash) && devbox run serve"
14+
},
15+
"windows": {
16+
"command": "where devbox >nul 2>&1 || (echo 'Devbox is not installed. Please visit https://www.jetpack.io/devbox/docs/installing_devbox/ for installation instructions.') && devbox run serve"
17+
},
18+
"problemMatcher": [],
19+
"group": {
20+
"kind": "build",
21+
"isDefault": true
22+
},
23+
"presentation": {
24+
"reveal": "always",
25+
"panel": "new"
26+
}
27+
}
28+
]
29+
}

Pipfile.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 48 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,52 @@
1-
# Staging the docs on local machine
1+
# Staging the Docs on Your Local Machine
22

3-
1. Clone this repo and run installation script:
4-
```
5-
git clone https://github.com/virtuozzo/docs.git
6-
cd docs
7-
sudo ./install.sh
8-
```
3+
This guide walks you through the process of staging the documentation locally using either a Devbox or a Dev Container. First, you need to clone the repository:
94

10-
2. To run the docs, issue the following command:
11-
```
12-
mkdocs serve
5+
```bash
6+
git clone [email protected]:virtuozzo/cloudscripting-docs.git
7+
cd cloudscripting-docs
138
```
14-
MkDocs incrementally rebuilds the site each time a file changes.
15-
You can keep your browser open to [http://localhost:8000/](http://localhost:8000/) and refresh to see the changes.
16-
Use CTRL+C to stop the server and get the command prompt back.
179

10+
After cloning the repository, you have two options to run the docs web server: using a Devbox isolated shell or a Dev Container.
11+
12+
**Devbox** provides a faster alternative by installing all dependencies into an isolated shell, while **Dev Container** offers more isolation and could be simpler to install.
13+
14+
## Using Devbox
15+
16+
Devbox is recommended for users who prefer a quick setup with isolated environments. Follow these steps to use Devbox:
17+
18+
1. Install Devbox from [here](https://www.jetpack.io/devbox/docs/installing_devbox/).
19+
2. To start the docs web server, execute one of the following commands:
20+
21+
```bash
22+
devbox run serve
23+
```
24+
25+
or
26+
27+
```bash
28+
devbox shell
29+
task serve
30+
```
31+
32+
Alternatively, in VS Code, you can run the `Start the Docs web server` task, which automatically starts the local server for the documentation. To do this:
33+
34+
- Use the command palette in VS Code (Ctrl+Shift+P or Cmd+Shift+P), type `Tasks: Run Task`, and select `Start the Docs web server`.
35+
- Or, navigate to `Terminal -> Run Task...` and choose `Start the Docs web server`.
36+
37+
## Using a Dev Container
38+
39+
For those preferring VS Code and seeking greater isolation, the Dev Container method is ideal. Follow these steps:
40+
41+
1. Install the **Dev Containers** extension in VS Code.
42+
2. Open the `cloudscripting-docs` repository in VS Code.
43+
3. Use the command palette (Ctrl+Shift+P or Cmd+Shift+P), type `Dev Containers: Reopen in Container`, and select it.
44+
4. VS Code will rebuild the container using the `.devcontainer` folder's configuration.
45+
5. Once the container is ready, you're set to work within the Dev Container environment.
46+
6. To start the docs, issue this command in the integrated terminal:
47+
48+
```bash
49+
task serve
50+
```
51+
52+
MkDocs will incrementally rebuild the site with each file change. Keep your browser open to [http://localhost:8000/](http://localhost:8000/) and refresh to view updates. Use CTRL+C in the terminal to stop the server.

Taskfile.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,34 @@
11
version: "3"
22

33
tasks:
4+
check-and-install-deps:
5+
desc: "Check and install dependencies"
6+
cmds:
7+
- pipenv run which mkdocs && pipenv install --dev || true
8+
internal: true
9+
410
serve:
511
desc: "Start the development server"
12+
deps:
13+
- check-and-install-deps
614
cmds:
715
- pipenv run mkdocs serve
816

917
build:
1018
desc: "Build the current version of the documentation"
19+
deps:
20+
- check-and-install-deps
1121
cmds:
1222
- pipenv run mkdocs build
1323

1424
build-all:
15-
desc: "Build all versions described in the mkdocs.yml"
25+
desc: >-
26+
Build all versions described in the mkdocs.yml for production.
27+
Make sure to commit the changes before running this task.
28+
All uncommitted changes will be stashed and can be restored via 'git stash apply 0' in the branch you were working on.
29+
30+
deps:
31+
- check-and-install-deps
1632
cmds:
1733
- DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )";
1834
VERSION=$1;

devbox.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
{
22
"packages": {
3-
"python": "3.5.9",
4-
"pipenv": "2020.6.2",
3+
"python": "3.5.9",
4+
"pipenv": "2020.6.2",
55
"go-task": "3.35.1"
66
},
77
"shell": {
88
"init_hook": [
99
""
1010
],
1111
"scripts": {
12-
"serve": "task serve",
13-
"build": "task build",
12+
"serve": "task serve",
13+
"build": "task build",
1414
"build-all": "task build-all"
1515
}
1616
}
17-
}
17+
}

0 commit comments

Comments
 (0)