update .devcontainers

This commit is contained in:
Christian Bräunlich 2024-09-01 07:23:20 +00:00
parent 2520893058
commit 77c64d7670
2 changed files with 29 additions and 43 deletions

View file

@ -1,16 +1,17 @@
# Update the NODE_VERSION arg in docker-compose.yml to pick a Node version: 10, 12, 14 # syntax=docker/dockerfile:1
ARG NODE_VERSION=14 FROM mcr.microsoft.com/devcontainers/base:ubuntu-22.04
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${NODE_VERSION}
# ARG USER=vscode
# ARG DEBIAN_FRONTEND=noninteractive
# RUN usermod -s /usr/bin/zsh ${USER}
# VARIANT can be either 'hugo' for the standard version or 'hugo_extended' for the extended version. # VARIANT can be either 'hugo' for the standard version or 'hugo_extended' for the extended version.
ARG VARIANT=hugo ARG VARIANT=hugo_extended
# VERSION can be either 'latest' or a specific version number # VERSION can be either 'latest' or a specific version number
ARG VERSION=latest ARG VERSION=latest
# Download Hugo # Download Hugo
RUN apt-get update && apt-get install -y ca-certificates openssl git curl && \ RUN case ${VERSION} in \
rm -rf /var/lib/apt/lists/* && \
case ${VERSION} in \
latest) \ latest) \
export VERSION=$(curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4)}') ;;\ export VERSION=$(curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4)}') ;;\
esac && \ esac && \
@ -27,12 +28,4 @@ RUN apt-get update && apt-get install -y ca-certificates openssl git curl && \
mv hugo /usr/bin/hugo mv hugo /usr/bin/hugo
# Hugo dev server port # Hugo dev server port
EXPOSE 1313 EXPOSE 1313
# [Optional] Uncomment this section to install additional OS packages you may want.
#
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>
# [Optional] Uncomment if you want to install more global node packages
# RUN sudo -u node npm install -g <your-package-list-here>

View file

@ -1,41 +1,34 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: // For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.217.4/containers/hugo // https://github.com/microsoft/vscode-dev-containers/tree/v0.217.4/containers/hugo
{ {
"name": "Hugo (Community)", "name": "Hugo",
"build": { "build": {
"dockerfile": "Dockerfile", "dockerfile": "Dockerfile"
"args": { },
// Update VARIANT to pick hugo variant. "customizations": {
// Example variants: hugo, hugo_extended "vscode": {
// Rebuild the container if it already exists to update. // Set *default* container specific settings.json values on container create.
"VARIANT": "hugo_extended", "settings": {
// Update VERSION to pick a specific hugo version. "html.format.templating": true
// Example versions: latest, 0.73.0, 0,71.1 },
// Rebuild the container if it already exists to update. // Add the IDs of extensions you want installed when the container is created.
"VERSION": "latest", "extensions": [
// Update NODE_VERSION to pick the Node.js version: 12, 14 "bungcip.better-toml",
"NODE_VERSION": "14", "davidanson.vscode-markdownlint",
"GitHub.vscode-pull-request-github"
]
} }
}, },
// Set *default* container specific settings.json values on container create.
"settings": {
"html.format.templating": true,
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"bungcip.better-toml",
"davidanson.vscode-markdownlint",
"GitHub.vscode-pull-request-github"
],
// Use 'forwardPorts' to make a list of ports inside the container available locally. // Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [ "forwardPorts": [
1313 1313
], ],
"remoteUser": "vscode",
// Use 'postCreateCommand' to run commands after the container is created. // Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "git submodule update --init --recursive --depth 1 && npm i", // "postCreateCommand": ""
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "node",
"features": { "features": {
"git": "os-provided" "ghcr.io/devcontainers/features/git:1": {},
"ghcr.io/devcontainers/features/go:1": {},
"ghcr.io/devcontainers/features/hugo:1": {}
} }
} }