commit 487cc8e2dd899ad600e2af9d9a3b61f476187cde Author: daniel <2+daniel@noreply.git.bovender.de> Date: Sat Aug 8 11:41:41 2026 +0200 Initial commit diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..26d8447 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,9 @@ +FROM ghcr.io/gohugoio/hugo:latest + +USER root +# The image's "hugo" user is a system account (adduser -S) with shell /sbin/nologin, +# since it's only meant to run the hugo binary. VS Code's integrated terminal needs +# an interactive shell, so give it one. +RUN apk add --no-cache git-lfs && \ + sed -i 's#/sbin/nologin#/bin/sh#' /etc/passwd +USER hugo:hugo diff --git a/.devcontainer/devcontainer-lock.json b/.devcontainer/devcontainer-lock.json new file mode 100644 index 0000000..491eb43 --- /dev/null +++ b/.devcontainer/devcontainer-lock.json @@ -0,0 +1,14 @@ +{ + "features": { + "ghcr.io/devcontainers/features/common-utils:2": { + "version": "2.5.9", + "resolved": "ghcr.io/devcontainers/features/common-utils@sha256:cb0c4d3c276f157eed17935747e364178d75fee17f55c4e129966f64633deb3a", + "integrity": "sha256:cb0c4d3c276f157eed17935747e364178d75fee17f55c4e129966f64633deb3a" + }, + "ghcr.io/devcontainers/features/git-lfs:1": { + "version": "1.2.5", + "resolved": "ghcr.io/devcontainers/features/git-lfs@sha256:71c2b371cf12ab7fcec47cf17369c6f59156100dad9abf9e4c593049d789de72", + "integrity": "sha256:71c2b371cf12ab7fcec47cf17369c6f59156100dad9abf9e4c593049d789de72" + } + } +} diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..d9ee096 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,28 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-docker-compose +{ + "name": "Förderverein Niere e.V.", + "dockerComposeFile": [ + "../docker-compose.yml", + "docker-compose.yml" + ], + "service": "server", + "workspaceFolder": "/project", + "postCreateCommand": "git lfs install", + "customizations": { + "vscode": { + "extensions": [ + "arr.marksman", + "mjmlio.vscode-mjml", + "davidanson.vscode-markdownlint", + "ecmel.vscode-html-css", + "redhat.vscode-yaml", + "yzhang.markdown-all-in-one", + "jsynowiec.vscode-insertdatestring", + "netcorext.uuid-generator", + "motivesoft.vscode-uuid-generator", + "jsynowiec.vscode-insertdatestring" + ] + } + } +} diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml new file mode 100644 index 0000000..627e9e0 --- /dev/null +++ b/.devcontainer/docker-compose.yml @@ -0,0 +1,19 @@ +services: + # Update this to the name of the service you want to work with in your docker-compose.yml file + server: + # Build on top of the hugo image so git-lfs can be installed as root at build time + # (the base image, and this override, run as the non-root "hugo" user at container + # runtime, so postCreateCommand can no longer apk add anything). + build: + context: . + dockerfile: .devcontainer/Dockerfile + + # Uncomment the next four lines if you will use a ptrace-based debugger like C++, Go, and Rust. + # cap_add: + # - SYS_PTRACE + # security_opt: + # - seccomp:unconfined + + # Overrides default command so things don't shut down after the process ends. + # command: sleep infinity + diff --git a/.gitea/workflows/build-and-deploy.yaml b/.gitea/workflows/build-and-deploy.yaml new file mode 100644 index 0000000..16e2c7a --- /dev/null +++ b/.gitea/workflows/build-and-deploy.yaml @@ -0,0 +1,71 @@ +name: Build and Deploy + +on: + push: + branches: + - main + schedule: + - cron: '0 0 * * *' + timezone: 'Europe/Berlin' + workflow_dispatch: + +jobs: + build-and-deploy: + runs-on: self-hosted + + container: + image: ghcr.io/gohugoio/hugo:latest + options: --user root + env: + HUGO_ENVIRONMENT: production + + steps: + - name: Checkout + uses: actions/checkout@v4 + # with: + # submodules: true # Required if your theme is a Git submodule + # fetch-depth: 0 # Hugo uses full history for .GitInfo and lastmod + + - name: Install git and git-lfs + run: | + apk add --no-cache git git-lfs + git lfs install + + - name: Pull LFS objects + run: git lfs pull + + - name: Install Bootstrap/Sass + run: | + npm install bootstrap sass + mkdir -p themes/bootstrap-theme/assets/scss/bootstrap + cp -r node_modules/bootstrap/scss/. themes/bootstrap-theme/assets/scss/bootstrap + + - name: Update modules + run: hugo mod get -u + + - name: Build site + env: + HUGO_GIT_BRANCH: ${{ gitea.ref_name }} + run: hugo --minify + + - name: Install rsync and openssh-client + run: | + apk add --no-cache rsync openssh-client + # Hugo's official image is Alpine-based; use apk. + # If a Debian-based Hugo image is used, swap to: + # apt-get update && apt-get install -y rsync openssh-client + + - name: Set up SSH key + run: | + mkdir -p ~/.ssh + echo "${{ secrets.DEPLOY_SSH_KEY }}" > ~/.ssh/id_ed25519 + chmod 600 ~/.ssh/id_ed25519 + echo "${{ secrets.DEPLOY_KNOWN_HOSTS }}" > ~/.ssh/known_hosts + chmod 644 ~/.ssh/known_hosts + + - name: Deploy via rsync + run: | + rsync -avz --delete \ + -e "ssh -i ~/.ssh/id_ed25519 -o StrictHostKeyChecking=yes" \ + public/ \ + ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }}:/${{ secrets.DEPLOY_SUBDIR }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cfa20d2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +public/ +*/_gen/* +*template*.html diff --git a/README.md b/README.md new file mode 100644 index 0000000..b193b32 --- /dev/null +++ b/README.md @@ -0,0 +1,13 @@ +# hugo-template + +**Template for websites powered by Hugo.** + +This uses YAML configuration files stored in `config/`. + +Customize the template as follows: + +- Edit `config/_default.hugo.yaml`. +- Change the project name in: + - `.devcontainer/devcontainer.json` + - `docker-compose.yml` +- Change the module name in `go.mod` to something else, e.g. the project's public repository URL. diff --git a/archetypes/.gitkeep b/archetypes/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/archetypes/default.md b/archetypes/default.md new file mode 100644 index 0000000..25b6752 --- /dev/null +++ b/archetypes/default.md @@ -0,0 +1,5 @@ ++++ +date = '{{ .Date }}' +draft = true +title = '{{ replace .File.ContentBaseName "-" " " | title }}' ++++ diff --git a/assets/.gitkeep b/assets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/config/_default/hugo.yaml b/config/_default/hugo.yaml new file mode 100644 index 0000000..3d77705 --- /dev/null +++ b/config/_default/hugo.yaml @@ -0,0 +1,3 @@ +baseURL: https://example.org/ +locale: en-us +title: My New Hugo Project diff --git a/content/.gitkeep b/content/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/data/.gitkeep b/data/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..0917644 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,23 @@ +name: Website powered by Hugo +services: + build: + image: ghcr.io/gohugoio/hugo:latest + command: build --minify + volumes: + - ".:/project" + user: 1000:1000 + environment: + HUGO_ENVIRONMENT: production + server: + image: ghcr.io/gohugoio/hugo:latest + command: server --bind 0.0.0.0 -M --buildDrafts --buildFuture + volumes: + - ".:/project" + - "../../../../local/Code/hugo_bootstrap_theme:/hugo_bootstrap_theme" + - "../../../../local/Code/hugo_cookie_consent:/hugo_cookie_consent" + ports: + - "127.0.0.1:1313:1313" + user: 1000:1000 + environment: + HUGO_ENVIRONMENT: development + TZ: Europe/Berlin diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..694b446 --- /dev/null +++ b/go.mod @@ -0,0 +1,8 @@ +module website_powered_by_hugo + +go 1.22 + +require ( + git.bovender.de/daniel/hugo_bootstrap_theme v0.0.1 // indirect + git.bovender.de/daniel/hugo_cookie_consent v0.0.6 // indirect +) diff --git a/hugo.work b/hugo.work new file mode 100644 index 0000000..2a28e35 --- /dev/null +++ b/hugo.work @@ -0,0 +1,5 @@ +go 1.22 + +use . +use ../hugo_cookie_consent +use ../hugo_bootstrap_theme diff --git a/i18n/.gitkeep b/i18n/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/layouts/.gitkeep b/layouts/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/static/.gitkeep b/static/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/themes/.gitkeep b/themes/.gitkeep new file mode 100644 index 0000000..e69de29