Skip to content

Commit 8efe229

Browse files
fujitatomoyaJEnoch
authored andcommitted
enable devcontainer with updating Dockerfile.
Signed-off-by: Tomoya Fujita <tomoya.fujita825@gmail.com>
1 parent bfef02f commit 8efe229

File tree

4 files changed

+114
-11
lines changed

4 files changed

+114
-11
lines changed

.devcontainer/devcontainer.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "Zenoh Web Documentation",
3+
"build": {
4+
"dockerfile": "../docker/Dockerfile",
5+
"args": {
6+
"user": "vscode",
7+
"uid": "1000"
8+
}
9+
},
10+
"workspaceMount": "source=${localWorkspaceFolder},target=/src,type=bind",
11+
"workspaceFolder": "/src",
12+
"features": {
13+
"ghcr.io/devcontainers/features/git:1": {}
14+
},
15+
"forwardPorts": [1313],
16+
"portsAttributes": {
17+
"1313": {
18+
"label": "Hugo Server",
19+
"onAutoForward": "notify"
20+
}
21+
},
22+
"customizations": {
23+
"vscode": {
24+
"extensions": [
25+
"ritwickdey.LiveServer",
26+
"budparr.language-hugo-vscode",
27+
"davidanson.vscode-markdownlint"
28+
],
29+
"settings": {
30+
"terminal.integrated.defaultProfile.linux": "bash"
31+
}
32+
}
33+
},
34+
"postCreateCommand": "hugo version",
35+
"remoteUser": "vscode"
36+
}

.github/workflows/deploy-website.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Setup Hugo
1919
uses: peaceiris/actions-hugo@v2
2020
with:
21-
hugo-version: '0.102.1'
21+
hugo-version: '0.145.0'
2222
# extended: true
2323

2424
- name: Build

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,31 @@ The website for the Eclipse zenoh project. Lives at [http://zenoh.io](https://ze
44

55
## Getting Started
66

7+
### Using Dev Container (Recommended)
8+
9+
The easiest way to develop the Zenoh web documentation is using VS Code Dev Containers, which provides a consistent development environment without installing Hugo locally.
10+
11+
**Prerequisites:**
12+
13+
- [Docker](https://www.docker.com/get-started) installed and running
14+
- [Visual Studio Code](https://code.visualstudio.com/)
15+
- [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) for VS Code
16+
17+
**Steps:**
18+
19+
1. Open this repository in VS Code
20+
2. When prompted, click "Reopen in Container" (or press F1 and select "Dev Containers: Reopen in Container")
21+
3. VS Code will build the Docker container and set up the development environment
22+
4. Once ready, run the development server:
23+
24+
```bash
25+
hugo server
26+
```
27+
28+
5. Visit [http://localhost:1313](http://localhost:1313)
29+
30+
### Local Hugo Installation
31+
732
The website should build with the latest version of Hugo, the last tested is [Hugo 0.145.0](http://gohugo.io).
833
On MacOS you can install Hugo as described below, in any case refer to [Hugo Documentation](http://gohugo.io)
934
for installation instructioins
@@ -22,6 +47,18 @@ hugo server
2247

2348
Then visit [http://localhost:1313](http://localhost:1313).
2449

50+
### Using Docker Directly
51+
52+
If you prefer to use Docker without VS Code:
53+
54+
```bash
55+
# Build the Docker image
56+
docker build -f docker/Dockerfile --build-arg user=$(id -un) --build-arg uid=$(id -u) -t zenoh_web .
57+
58+
# Run the development server
59+
docker run --rm -v $(pwd):/src -p 1313:1313 zenoh_web
60+
```
61+
2562
## License
2663

2764
This project is licensed under the [Eclipse Public License 2.0](LICENSE)

docker/Dockerfile

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,49 @@
1-
FROM alpine:latest
1+
# This dockerfile is expecting to be run with the following build command
2+
# (from the root of the git repository):
3+
#
4+
# $ docker build -f docker/Dockerfile -t zenoh_web .
5+
#
6+
# Then, to use the image to build the docs:
7+
#
8+
# $ docker run --rm -v $(pwd):/src -p 1313:1313 zenoh_web
29

3-
RUN apk add --no-cache \
4-
curl \
5-
git
10+
FROM ubuntu:noble
11+
12+
ARG user=hugo
13+
ARG uid=1000
14+
15+
ENV DEBIAN_FRONTEND=noninteractive
16+
ENV SHELL=/bin/bash
17+
18+
# Delete user if it exists in container (e.g Ubuntu Noble: ubuntu)
19+
RUN if id -u $uid ; then userdel `id -un $uid` ; fi
20+
21+
RUN apt-get update && \
22+
apt-get install --no-install-recommends -y \
23+
curl \
24+
git \
25+
ca-certificates \
26+
locales && \
27+
rm -rf /var/lib/apt/lists/*
28+
29+
RUN locale-gen en_US en_US.UTF-8
30+
RUN update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
31+
ENV LANG=en_US.UTF-8
32+
33+
RUN useradd -u $uid -m $user
34+
35+
ENV HOME=/home/$user
36+
ENV VERSION=0.145.0
637

7-
ENV VERSION 0.88.1
838
RUN mkdir -p /usr/local/src \
939
&& cd /usr/local/src \
10-
11-
&& curl -L https://github.com/gohugoio/hugo/releases/download/v${VERSION}/hugo_${VERSION}_linux-64bit.tar.gz | tar -xz \
40+
&& curl -L https://github.com/gohugoio/hugo/releases/download/v${VERSION}/hugo_${VERSION}_linux-amd64.tar.gz | tar -xz \
1241
&& mv hugo /usr/local/bin/hugo \
42+
&& chmod +x /usr/local/bin/hugo
1343

14-
&& addgroup -Sg 1000 hugo \
15-
&& adduser -SG hugo -u 1000 -h /src hugo
16-
44+
USER $user
1745
WORKDIR /src
1846

1947
EXPOSE 1313
48+
49+
CMD ["hugo", "server"]

0 commit comments

Comments
 (0)