From 9ceea7cbbe0dbbf8a5df4d53a08360ba3ebacf20 Mon Sep 17 00:00:00 2001 From: morthimer Date: Sun, 19 May 2024 20:16:31 +0000 Subject: [PATCH] init: first commit --- .gitea/workflows/publish-image.yml | 38 +++++++++ Dockerfile | 30 +++++++ Makefile | 18 +++++ README.md | 4 +- rootfs/home/morthimer/www/hugo.toml | 55 +++++++++++++ rootfs/home/morthimer/www/layouts/index.html | 78 +++++++++++++++++++ .../www/layouts/partials/typeIndex.html | 70 +++++++++++++++++ 7 files changed, 292 insertions(+), 1 deletion(-) create mode 100644 .gitea/workflows/publish-image.yml create mode 100644 Dockerfile create mode 100644 Makefile create mode 100644 rootfs/home/morthimer/www/hugo.toml create mode 100644 rootfs/home/morthimer/www/layouts/index.html create mode 100644 rootfs/home/morthimer/www/layouts/partials/typeIndex.html diff --git a/.gitea/workflows/publish-image.yml b/.gitea/workflows/publish-image.yml new file mode 100644 index 0000000..3384a74 --- /dev/null +++ b/.gitea/workflows/publish-image.yml @@ -0,0 +1,38 @@ +name: Publish morthimer/website image + +on: + push: + tags: + - '[0-9]+.[0-9]+.[0-9]+' + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Repository checkout + uses: actions/checkout@v4 + - name: Lint Dockerfile with Hadolint + uses: hadolint/hadolint-action@v3.1.0 + with: + dockerfile: Dockerfile + + build: + runs-on: ubuntu-latest + needs: lint + steps: + - name: Repository login + uses: docker/login-action@v3 + with: + registry: ${{ secrets.DOCKER_REGISTRY }} + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and push image + uses: docker/build-push-action@v5 + with: + push: true + tags: | + ${{ secrets.DOCKER_REGISTRY }}/${{ gitea.repository }}:latest + ${{ secrets.DOCKER_REGISTRY }}/${{ gitea.repository }}:${{ gitea.tag }} + build-args: | + img_ver=${{ gitea.tag }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9df6c92 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,30 @@ +FROM alpine:3 + +ARG img_ver +ENV IMAGE_VERSION ${img_ver} + +LABEL org.opencontainers.image.title="Website" \ + org.opencontainers.image.description="My website -- morthimer.fr" \ + org.opencontainers.image.source="https://git.int.morthimer.fr/morthimer/website" \ + org.opencontainers.image.url="https://git.int.morthimer.fr/morthimer/website" \ + org.opencontainers.image.authors="morthimer" +LABEL org.opencontainers.image.version="${IMAGE_VERSION}" + + +RUN apk update && apk upgrade \ + && apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community hugo go git \ + && addgroup -g 1000 morthimer \ + && adduser -u 1000 -G morthimer -s /bin/sh -D morthimer + +USER morthimer +WORKDIR /home/morthimer + +RUN hugo new site www \ + && cd www \ + && hugo mod init git.morthimer.fr +COPY --chown=morthimer:morthimer rootfs/ / +WORKDIR /home/morthimer/www + +EXPOSE 1313 +ENTRYPOINT [ "hugo" ] +CMD [ "server", "--bind", "0.0.0.0", "-w", "-D" ] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..508485a --- /dev/null +++ b/Makefile @@ -0,0 +1,18 @@ +init-sandbox: + docker run -d --name dev-ct alpine sleep infinity + docker exec -it dev-ct ash + +clean-sandbox: + docker stop dev-ct && docker rm dev-ct + +lint: + docker run --rm -i ghcr.io/hadolint/hadolint < Dockerfile + +build-dev: + docker build --no-cache -t hugo-dev . + +run-dev: + docker run -p 80:1313 --name hugo-dev -d hugo-dev + +clean-dev: + docker rm -f hugo-dev \ No newline at end of file diff --git a/README.md b/README.md index d9bfd3b..2ff7d9e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ -# website +# website - https://morthimer.fr +# Description +This portfolio website was made with (Hugo)[https://gohugo.io/] with this (theme)[https://github.com/Yukuro/hugo-theme-shell] \ No newline at end of file diff --git a/rootfs/home/morthimer/www/hugo.toml b/rootfs/home/morthimer/www/hugo.toml new file mode 100644 index 0000000..d442554 --- /dev/null +++ b/rootfs/home/morthimer/www/hugo.toml @@ -0,0 +1,55 @@ +baseURL = "http://localhost/" +title = "Shell" +ignoreErrors = ["error-remote-getjson"] + +[module] + [[module.imports]] + path = 'github.com/yukuro/hugo-theme-shell' + +[params] + description = "morthimer's Portfolio" + [params.Terminal] + schema = "gruvbox_dark" + + userName = "guest" + pcName = "morthimer.fr" + workDir = "www" + profile = "profile.txt" + + ps1Delay = 20 + stdoutDelay = 20 + commandDelay = 40 + + titleDelay = 0 + contentDelay = 0 + + description = """ + Greetings! + I'm morthimer. + + Skills: + - Docker, Kubernetes + - Python, Bash, Go + - Ansible, Terraform + - GitLab CI, GitHub Actions, ArgoCD + - Prometheus, Loki, Grafana + """ + + [params.Tree] + use = true + folderName = "links" + files = [ + ["Git", "https://git.morthimer.fr"], + ["Wiki", "https://wiki.morthimer.fr"], + ] + + [params.Tree2] + use = true + folderName = "bookmarks" + files = [ + ["IT Roadmaps", "https://roadmap.sh/"], + ["DevOps Training", "https://github.com/bregman-arie/devops-exercises"], + ["Awesome Content","https://github.com/sindresorhus/awesome"], + ["server-world.info","https://www.server-world.info/en/"], + ["The Brutalist Report", "https://brutalist.report/" ], + ] \ No newline at end of file diff --git a/rootfs/home/morthimer/www/layouts/index.html b/rootfs/home/morthimer/www/layouts/index.html new file mode 100644 index 0000000..f6144e3 --- /dev/null +++ b/rootfs/home/morthimer/www/layouts/index.html @@ -0,0 +1,78 @@ +{{ define "main" }} + {{ $env := printf "%s@%s:~/%s$" .Site.Params.Terminal.userName .Site.Params.Terminal.pcName "" | safeHTML }} + {{ $envWithDir := printf "%s@%s:~/%s$" .Site.Params.Terminal.userName .Site.Params.Terminal.pcName .Site.Params.Terminal.workDir | safeHTML }} + + {{ $cd := printf "cd %s" .Site.Params.Terminal.workDir | safeHTML }} + {{ $cat := printf "cat %s" .Site.Params.Terminal.profile | safeHTML }} + + {{ $description := "" }} + {{ if eq (substr .Site.Params.Terminal.description -3 3) ".md" }} + {{ $s := "" }} + {{ with .Site.GetPage .Site.Params.Terminal.description }} + + {{ $s = replaceRE "]*>" "" .Content 1 }} + {{ end }} + {{ $description = printf "%s" $s | safeHTML}} + {{ else }} + {{ $limit := sub (len (findRE "\n" .Site.Params.Terminal.description)) 1 }} + {{ $description = printf "%s" .Site.Params.Terminal.description }} + {{ $description = replaceRE "\n" "
" $description $limit| safeHTML }} + {{ end }} + + {{ $tree := "" }} + {{ $leaf := "" }} + {{ if .Site.Params.Tree.use }} + {{ $tree = printf "tree ./%s/" .Site.Params.Tree.folderName | safeHTML}} + {{ $leaf = printf "%s./%s/
" $leaf .Site.Params.Tree.folderName | safeHTML}} + {{ range $index, $val := .Site.Params.Tree.files }} + {{ $ac := index $val 0}} + {{ $link := index $val 1}} + + + {{ $l := $.Site.GetPage $link }} + {{ if $l }} + {{ $link = $l.Permalink}} + {{ end }} + + {{ if eq (add $index 1) (len $.Site.Params.Tree.files) }} + {{ $leaf = printf "%s└── %s" $leaf $link $ac | safeHTML}} + {{ else }} + {{ $leaf = printf "%s├── %s
" $leaf $link $ac | safeHTML}} + {{ end }} + {{ end }} + {{ end }} + + {{ $tree2 := "" }} + {{ $leaf2 := "" }} + {{ if .Site.Params.Tree2.use }} + {{ $tree2 = printf "tree ./%s/" .Site.Params.Tree2.folderName | safeHTML}} + {{ $leaf2 = printf "%s./%s/
" $leaf2 .Site.Params.Tree2.folderName | safeHTML}} + {{ range $index, $val := .Site.Params.Tree2.files }} + {{ $ac := index $val 0}} + {{ $link := index $val 1}} + + + {{ $l := $.Site.GetPage $link }} + {{ if $l }} + {{ $link = $l.Permalink}} + {{ end }} + + {{ if eq (add $index 1) (len $.Site.Params.Tree2.files) }} + {{ $leaf2 = printf "%s└── %s" $leaf2 $link $ac | safeHTML}} + {{ else }} + {{ $leaf2 = printf "%s├── %s
" $leaf2 $link $ac | safeHTML}} + {{ end }} + {{ end }} + {{ end }} + + {{ $end := $env }} + + {{ $payload := delimit (slice $cd $cat $description $tree $leaf $end) "" }} + + {{ $ps1Delay := $.Site.Params.Terminal.ps1Delay }} + {{ $stdoutDelay := $.Site.Params.Terminal.stdoutDelay }} + {{ $commandDelay := $.Site.Params.Terminal.commandDelay }} + + {{ partial "partials/typeIndex.html" (dict "context" . "env" $env "cd" $cd "envWithDir" $envWithDir "cat" $cat "description" $description "tree" $tree "leaf" $leaf "tree2" $tree2 "leaf2" $leaf2 "ps1delay" $ps1Delay "stdoutdelay" $stdoutDelay "commanddelay" $commandDelay ) }} + +{{ end }} diff --git a/rootfs/home/morthimer/www/layouts/partials/typeIndex.html b/rootfs/home/morthimer/www/layouts/partials/typeIndex.html new file mode 100644 index 0000000..59f884f --- /dev/null +++ b/rootfs/home/morthimer/www/layouts/partials/typeIndex.html @@ -0,0 +1,70 @@ +
+
+
+
+
+
+
+ + + \ No newline at end of file