Skip to content

Instantly share code, notes, and snippets.

Last active Feb 24, 2022
What would you like to do?
Containerized Hugo (extended) with VSCode devcontainer
// For format details, see or this file's README at:
"name": "Hugo",
"build": {
"dockerfile": "Dockerfile",
"args": {
// Update VARIANT to pick hugo variant.
// Example variants: hugo, hugo_extended
// Rebuild the container if it already exists to update.
"VARIANT": "hugo_extended",
// Update VERSION to pick a specific hugo version.
// Example versions: latest, 0.73.0, 0,71.1
// Rebuild the container if it already exists to update.
"VERSION": "latest",
// Set *default* container specific settings.json values on container create.
"settings": {
"": "/bin/zsh"
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "uname -a",
// Uncomment to use Docker from inside the container. See
// "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ],
// Uncomment when using a ptrace-based debugger like C++, Go, and Rust
// "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],
// Uncomment to connect as a non-root user. See
"remoteUser": "vscode"
FROM golang:1.13-alpine
# VARIANT can be either 'hugo' for the standard version or 'hugo_extended' for the extended version.
ARG VARIANT=hugo_extended
# VERSION can be either 'latest' or a specific version number
RUN apk add --update --no-cache ca-certificates openssl git curl && \
case ${VERSION} in \
latest) \
export VERSION=$(curl -s | grep "tag_name" | awk '{print substr($2, 3, length($2)-4)}') ;;\
esac && \
echo ${VERSION} && \
wget -O ${VERSION}.tar.gz${VERSION}/${VARIANT}_${VERSION}_Linux-64bit.tar.gz && \
tar xf ${VERSION}.tar.gz && \
mv hugo* /usr/bin/hugo && \
go get && \
muslstack -s 0x800000 /usr/bin/hugo
# Required for hugo_extended
RUN apk add --update --no-cache libc6-compat
COPY --from=0 /usr/bin/hugo /usr/bin
CMD ["/usr/bin/hugo server"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment