Skip to content

Commit 97d485b

Browse files
committed
Update to support hugo extended
1 parent 1d7101a commit 97d485b

File tree

2 files changed

+87
-9
lines changed

2 files changed

+87
-9
lines changed

.devcontainer/Dockerfile

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Update the NODE_VERSION arg in docker-compose.yml to pick a Node version: 18, 16, 14
2+
ARG NODE_VERSION=16
3+
FROM mcr.microsoft.com/devcontainers/javascript-node:${NODE_VERSION}
4+
5+
# VARIANT can be either 'hugo' for the standard version or 'hugo_extended' for the extended version.
6+
ARG VARIANT=hugo_extended
7+
# VERSION can be either 'latest' or a specific version number
8+
ARG VERSION=latest
9+
10+
# Download Hugo
11+
RUN apt-get update && apt-get install -y ca-certificates openssl git curl && \
12+
rm -rf /var/lib/apt/lists/* && \
13+
case ${VERSION} in \
14+
latest) \
15+
export VERSION=$(curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4)}') ;;\
16+
esac && \
17+
echo ${VERSION} && \
18+
case $(uname -m) in \
19+
aarch64) \
20+
export ARCH=ARM64 ;; \
21+
*) \
22+
export ARCH=64bit ;; \
23+
esac && \
24+
echo ${ARCH} && \
25+
wget -O ${VERSION}.tar.gz https://github.com/gohugoio/hugo/releases/download/v${VERSION}/${VARIANT}_${VERSION}_Linux-${ARCH}.tar.gz && \
26+
tar xf ${VERSION}.tar.gz && \
27+
mv hugo /usr/bin/hugo
28+
29+
# Hugo dev server port
30+
EXPOSE 1313
31+
32+
# [Optional] Uncomment this section to install additional OS packages you may want.
33+
#
34+
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
35+
# && apt-get -y install --no-install-recommends <your-package-list-here>
36+
37+
# [Optional] Uncomment if you want to install more global node packages
38+
# RUN sudo -u node npm install -g <your-package-list-here>

.devcontainer/devcontainer.json

+49-9
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,51 @@
11
{
2+
"name": "Hugo (Community)",
3+
"build": {
4+
"dockerfile": "Dockerfile",
5+
"args": {
6+
// Update VARIANT to pick hugo variant.
7+
// Example variants: hugo, hugo_extended
8+
// Rebuild the container if it already exists to update.
9+
"VARIANT": "hugo_extended",
10+
// Update VERSION to pick a specific hugo version.
11+
// Example versions: latest, 0.73.0, 0,71.1
12+
// Rebuild the container if it already exists to update.
13+
"VERSION": "latest",
14+
// Update NODE_VERSION to pick the Node.js version: 12, 14
15+
"NODE_VERSION": "14"
16+
}
17+
},
218
"hostRequirements": {
3-
"cpus": 4,
4-
"memory": "16gb",
5-
"storage": "32gb"
6-
},
7-
"image": "mcr.microsoft.com/devcontainers/universal:2",
8-
"features": {
9-
},
10-
"postCreateCommand": "hugo server -D -F --baseURL \"https://$CODESPACE_NAME-1313.$GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN/\" -liveReloadPort=443 --appendPort=false --bind=0.0.0.0"
11-
}
19+
"cpus": 4,
20+
"memory": "16gb",
21+
"storage": "32gb"
22+
},
23+
// Configure tool-specific properties.
24+
"customizations": {
25+
// Configure properties specific to VS Code.
26+
"vscode": {
27+
// Set *default* container specific settings.json values on container create.
28+
"settings": {
29+
"html.format.templating": true
30+
},
31+
32+
// Add the IDs of extensions you want installed when the container is created.
33+
"extensions": [
34+
"bungcip.better-toml",
35+
"davidanson.vscode-markdownlint"
36+
]
37+
}
38+
},
39+
40+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
41+
"forwardPorts": [
42+
1313
43+
],
44+
45+
// Use 'postCreateCommand' to run commands after the container is created.
46+
"postCreateCommand": "hugo server -D -F --baseURL \"https://$CODESPACE_NAME-1313.$GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN/\" -liveReloadPort=443 --appendPort=false --bind=0.0.0.0 --logLevel=debug",
47+
48+
49+
// Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
50+
"remoteUser": "root"
51+
}

0 commit comments

Comments
 (0)