Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a Dev Container #96

Merged
merged 8 commits into from
Feb 3, 2025
Merged
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 mcr.microsoft.com/devcontainers/javascript-node:22-bookworm
LABEL repository="github.com/Galaxypedia-Wiki/Galaxypedia"
LABEL maintainer="cswimr <[email protected]>"

ARG USER=node
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.
ARG VARIANT=hugo_extended
# VERSION can be either 'latest' or a specific version number
ARG VERSION=0.139.0

# Download Hugo
RUN case ${VERSION} in \
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)}') ;;\
esac && \
echo ${VERSION} && \
case $(uname -m) in \
aarch64) \
export ARCH=ARM64 ;; \
*) \
export ARCH=64bit ;; \
esac && \
echo ${ARCH} && \
curl -Lo ${VERSION}.tar.gz https://github.com/gohugoio/hugo/releases/download/v${VERSION}/${VARIANT}_${VERSION}_Linux-${ARCH}.tar.gz && \
cswimr marked this conversation as resolved.
Show resolved Hide resolved
tar xf ${VERSION}.tar.gz && \
mv hugo /usr/bin/hugo

# Hugo dev server port
EXPOSE 1313

RUN corepack enable

USER ${USER}
ARG HOME=/home/${USER}
WORKDIR ${HOME}

ARG OHMYZSH_HOME=${HOME}/.oh-my-zsh

RUN <<EOT
hugo completion zsh > ${OHMYZSH_HOME}/plugins/git/_hugo
EOT
44 changes: 44 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "Galaxypedia",
"build": {
"context": "..",
"dockerfile": "Dockerfile"
},
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.defaultProfile.linux": "zsh",
"terminal.integrated.profiles.linux": {
"zsh": {
"path": "/bin/zsh"
}
},
"files.exclude": {
"**/.git": true,
"**/.cache": true,
"**/.pnpm-store": true
}
},
"extensions": [
"esbenp.prettier-vscode",
"davidanson.vscode-markdownlint",
"kaellarkin.hugo-shortcode-syntax",
"budparr.language-hugo-vscode",
"bradlc.vscode-tailwindcss",
"vasubasraj.flashpost",
"redhat.vscode-yaml",
"GitHub.vscode-pull-request-github",
"eamodio.gitlens",
"ms-azuretools.vscode-docker"
]
}
},
"containerEnv": {
"HUGO_CACHEDIR": "/workspaces/Galaxypedia/.cache"
},
"mounts": [
"source=hugo-cache,target=/workspaces/Galaxypedia/.cache,type=volume"
],
"remoteUser": "node",
"postCreateCommand": "sudo chown -R node:node /workspaces/Galaxypedia/.cache && pnpm i"
}
10 changes: 0 additions & 10 deletions .envrc

This file was deleted.

2 changes: 0 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ jobs:
extended: true
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Setup Node.js
uses: actions/setup-node@v4
with:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ jobs:
extended: true
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Setup Node.js
uses: actions/setup-node@v4
with:
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ node_modules/
.mypy_cache/
resources/
hugo_stats.json
.cache/
.pnpm-store/

# .vscode
.vscode/*
!.vscode/extensions.json
!.vscode/launch.json
!.vscode/settings.json
10 changes: 0 additions & 10 deletions .vscode/extensions.json

This file was deleted.

26 changes: 26 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Hugo Server",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "pnpm",
"runtimeArgs": ["serve"],
"console": "integratedTerminal"
},
{
"name": "Hugo Server (Fast Render disabled)",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "pnpm",
"runtimeArgs": ["serve", "--disableFastRender"],
"console": "integratedTerminal"
}
]
}
14 changes: 7 additions & 7 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.quickSuggestions": {
"other": "on",
"comments": "on",
"other": "on",
"strings": "on"
},
"editor.tabCompletion": "onlySnippets",
"files.trimTrailingWhitespace": false,
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
"files.trimTrailingWhitespace": false
},
"editor.formatOnSave": true,
"files.associations": {
".css": "tailwindcss"
},
"editor.formatOnSave": true,
"json.schemas": [
{
"fileMatch": ["*.json", "*.jsonc"],
Expand Down
Loading
Loading