From 351735a4d20048dea7c30b961f668580e628f44c Mon Sep 17 00:00:00 2001 From: Tai Groot Date: Mon, 16 Oct 2023 20:08:13 -0700 Subject: [PATCH] add codespace config --- .devcontainer/devcontainer.json | 49 +++++++++++++++++++++++++++++++++ .devcontainer/setup.sh | 22 +++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 .devcontainer/devcontainer.json create mode 100755 .devcontainer/setup.sh diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..b0d24a7 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,49 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu +{ + "name": "Ubuntu", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/javascript-node", + "features": { + "ghcr.io/devcontainers-contrib/features/act:1": {} + }, + "customizations": { + "vscode": { + "extensions": [ + "budparr.language-hugo-vscode", + "tamasfe.even-better-toml", + "esbenp.prettier-vscode", + "dbaeumer.vscode-eslint", + "bradlc.vscode-tailwindcss", + "bourhaouta.tailwindshades", + "austenc.tailwind-docs", + "GitHub.copilot", + "GitHub.copilot-chat", + "github.vscode-github-actions", + "ms-vscode.makefile-tools", + "vscodevim.vim", + "ms-vscode-remote.remote-containers" + ] + }, + "codespaces": { + } + }, + "hostRequirements": { + "cpus": 2 + }, + "waitFor": "onCreateCommand", + "onCreateCommand": "bash .devcontainer/setup.sh", + "updateContentCommand": "", + "postCreateCommand": "", + "postAttachCommand": { + "server": "source /etc/environment && yarn dev" + }, + + "portsAttributes": { + "1313": { + "label": "Hugo Blog", + "onAutoForward": "openPreview" + } + }, + "forwardPorts": [1313] +} diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh new file mode 100755 index 0000000..d5db511 --- /dev/null +++ b/.devcontainer/setup.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +set -euo pipefail +export HUGO_VERSION="0.119.0" +export GO_VERSION="1.21.3" + +pushd /tmp +curl -LO "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz" +tar -xvf hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz +sudo mv hugo /usr/local/bin/ +rm hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz +curl -LO "https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz" +sudo tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz +rm go${GO_VERSION}.linux-amd64.tar.gz +export PATH=$PATH:/usr/local/go/bin +echo PATH="/usr/local/share/nvm/current/bin:/usr/local/share/npm-global/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin" |sudo tee -a /etc/environment +echo "PATH=$PATH:/usr/local/go/bin" >> ~/.bashrc +source ~/.bashrc +go version +popd +hugo version +yarn project-setup +yarn install