From 93cfca9e6aadc329675efec9b708ccfd8347c936 Mon Sep 17 00:00:00 2001 From: somrat sorkar Date: Sun, 12 Nov 2023 11:03:44 +0000 Subject: [PATCH] added devcontainer --- .devcontainer/Dockerfile | 33 +++++++++++++++++++++++++++++++++ .devcontainer/devcontainer.json | 24 ++++++++++++++++++++++++ .vscode/tasks.json | 25 +++++++++++++++++++++++++ package.json | 2 +- 4 files changed, 83 insertions(+), 1 deletion(-) create mode 100755 .devcontainer/Dockerfile create mode 100755 .devcontainer/devcontainer.json create mode 100644 .vscode/tasks.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100755 index 0000000..fbcd8c8 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,33 @@ +# Update the arg in docker-compose.yml or devcontainer.json to switch arg versions +ARG NODE_VERSION=18 + +# main image +FROM mcr.microsoft.com/devcontainers/javascript-node:${NODE_VERSION} + +# Update the arg in docker-compose.yml or devcontainer.json to switch arg versions +ARG GO_VERSION=latest +ARG HUGO_VERSION=latest + +# Download necessary tools +RUN apt-get update && apt-get install -y \ + ca-certificates openssl git curl && \ + rm -rf /var/lib/apt/lists/* && \ + # set architecture + case $(uname -m) in \ + aarch64) \ + export ARCH=arm64 ;; \ + *) \ + export ARCH=amd64 ;; \ + esac && \ + # install Hugo + wget -O hugo_extended_${HUGO_VERSION}.tar.gz https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-${ARCH}.tar.gz && \ + tar xf hugo_extended_${HUGO_VERSION}.tar.gz && \ + mv hugo /usr/bin/hugo && \ + rm hugo_extended_${HUGO_VERSION}.tar.gz && \ + # install Go + wget -O go${GO_VERSION}.linux-${ARCH}.tar.gz https://dl.google.com/go/go${GO_VERSION}.linux-${ARCH}.tar.gz && \ + tar -C /usr/local -xzf go${GO_VERSION}.linux-${ARCH}.tar.gz && \ + rm go${GO_VERSION}.linux-${ARCH}.tar.gz + +# Export Go path +ENV PATH=$PATH:/usr/local/go/bin \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100755 index 0000000..3e7f007 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,24 @@ +{ + "name": "Hugo", + "build": { + "dockerfile": "Dockerfile", + "args": { + "NODE_VERSION": "20", + "GO_VERSION": "1.21.4", + "HUGO_VERSION": "0.120.4" + } + }, + "customizations": { + "vscode": { + "settings": {}, + "extensions": [ + "bradlc.vscode-tailwindcss", + "budparr.language-hugo-vscode", + "tamasfe.even-better-toml" + ] + } + }, + "remoteUser": "node", + "postCreateCommand": "npm install && npm run dev:example", + "forwardPorts": [1313] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..b745ebf --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,25 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + "version": "2.0.0", + "tasks": [ + { + "label": "Development", + "type": "shell", + "command": "yarn dev:example", + "isBackground": true, + "group": { + "kind": "test", + "isDefault": true + }, + }, + { + "label": "Build", + "type": "shell", + "command": "yarn build:example", + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} diff --git a/package.json b/package.json index 371848e..db9934d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "hugoplate", "description": "hugo tailwindcss boilerplate", - "version": "1.9.2", + "version": "1.9.3", "license": "MIT", "author": "zeon.studio", "scripts": {