added devcontainer

This commit is contained in:
somrat sorkar 2023-11-12 11:03:44 +00:00
parent eaf27f0ff8
commit 93cfca9e6a
4 changed files with 83 additions and 1 deletions

33
.devcontainer/Dockerfile Executable file
View File

@ -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

24
.devcontainer/devcontainer.json Executable file
View File

@ -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]
}

25
.vscode/tasks.json vendored Normal file
View File

@ -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
}
}
]
}

View File

@ -1,7 +1,7 @@
{ {
"name": "hugoplate", "name": "hugoplate",
"description": "hugo tailwindcss boilerplate", "description": "hugo tailwindcss boilerplate",
"version": "1.9.2", "version": "1.9.3",
"license": "MIT", "license": "MIT",
"author": "zeon.studio", "author": "zeon.studio",
"scripts": { "scripts": {