Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
FROM debian:bookworm-slim

ARG HUGO_VERSION=0.140.0
ARG GO_VERSION=1.21.0
ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=1000

# Detect architecture for cross-platform support
RUN ARCH="$(dpkg --print-architecture)" && echo "Building for ${ARCH}"

RUN apt-get update && apt-get install -y --no-install-recommends \
git \
curl \
ca-certificates \
sudo \
&& rm -rf /var/lib/apt/lists/*

# Install Go
RUN ARCH="$(dpkg --print-architecture)" \
&& curl -fsSL "https://go.dev/dl/go${GO_VERSION}.linux-${ARCH}.tar.gz" \
| tar -C /usr/local -xz

ENV PATH="/usr/local/go/bin:${PATH}"

# Install Hugo Extended
RUN ARCH="$(dpkg --print-architecture)" \
&& curl -fsSL "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-${ARCH}.tar.gz" \
| tar -C /usr/local/bin -xz hugo

# Create non-root user
RUN groupadd --gid ${USER_GID} ${USERNAME} \
&& useradd --uid ${USER_UID} --gid ${USER_GID} -m ${USERNAME} \
&& echo "${USERNAME} ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/${USERNAME} \
&& chmod 0440 /etc/sudoers.d/${USERNAME}

# Fix ARG scope - re-declare so it's visible to ENV
ARG USERNAME=vscode
ENV GOPATH="/home/${USERNAME}/go"
ENV GOMODCACHE="/home/${USERNAME}/go/pkg/mod"
ENV PATH="/home/${USERNAME}/go/bin:/usr/local/go/bin:${PATH}"

USER ${USERNAME}
WORKDIR /workspaces/lotusdocs
30 changes: 30 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "Lotus Docs",
"build": {
"dockerfile": "Dockerfile",
"args": {
"HUGO_VERSION": "0.140.0",
"GO_VERSION": "1.21.0"
}
},
"workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/lotusdocs,type=bind,consistency=cached",
"workspaceFolder": "/workspaces/lotusdocs",
"containerUser": "vscode",
"remoteUser": "vscode",
"forwardPorts": [1313],
"portsAttributes": {
"1313": {
"label": "Hugo Development Server - Lotus Docs",
"onAutoForward": "openPreview"
}
},
"postCreateCommand": "hugo mod get",
"postAttachCommand": "hugo server --bind 0.0.0.0 --port 1313 --buildDrafts --buildFuture --disableFastRender --navigateToChanged",
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.defaultProfile.linux": "bash"
}
}
}
}