Skip to content

Commit eb8b64b

Browse files
committed
add hugo devcontainer
1 parent 400ea9b commit eb8b64b

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed

.devcontainer/Dockerfile

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Update the NODE_VERSION arg in docker-compose.yml to pick a Node version: 10, 12, 14
2+
ARG NODE_VERSION=14
3+
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${NODE_VERSION}
4+
5+
# VARIANT can be either 'hugo' for the standard version or 'hugo_extended' for the extended version.
6+
ARG VARIANT=hugo
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+
wget -O ${VERSION}.tar.gz https://github.com/gohugoio/hugo/releases/download/v${VERSION}/${VARIANT}_${VERSION}_Linux-64bit.tar.gz && \
19+
tar xf ${VERSION}.tar.gz && \
20+
mv hugo /usr/bin/hugo
21+
22+
# Hugo dev server port
23+
EXPOSE 1313
24+
25+
# [Optional] Uncomment this section to install additional OS packages you may want.
26+
#
27+
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
28+
# && apt-get -y install --no-install-recommends <your-package-list-here>
29+
30+
# [Optional] Uncomment if you want to install more global node packages
31+
# RUN sudo -u node npm install -g <your-package-list-here>

.devcontainer/devcontainer.json

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.205.0/containers/hugo
3+
{
4+
"name": "Hugo (Community)",
5+
"build": {
6+
"dockerfile": "Dockerfile",
7+
"args": {
8+
// Update VARIANT to pick hugo variant.
9+
// Example variants: hugo, hugo_extended
10+
// Rebuild the container if it already exists to update.
11+
"VARIANT": "hugo_extended",
12+
// Update VERSION to pick a specific hugo version.
13+
// Example versions: latest, 0.73.0, 0,71.1
14+
// Rebuild the container if it already exists to update.
15+
"VERSION": "latest",
16+
// Update NODE_VERSION to pick the Node.js version: 12, 14
17+
"NODE_VERSION": "14",
18+
}
19+
},
20+
21+
// Set *default* container specific settings.json values on container create.
22+
"settings": {
23+
"html.format.templating": true,
24+
},
25+
26+
// Add the IDs of extensions you want installed when the container is created.
27+
"extensions": [
28+
"davidanson.vscode-markdownlint"
29+
],
30+
31+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
32+
"forwardPorts": [
33+
1313
34+
],
35+
36+
// Use 'postCreateCommand' to run commands after the container is created.
37+
// "postCreateCommand": "uname -a",
38+
39+
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
40+
"remoteUser": "node"
41+
}

0 commit comments

Comments
 (0)