From 7e8e32ac61a72e1ad7e29643696cbcb27e5a66bf Mon Sep 17 00:00:00 2001 From: Ada <ada@gnous.eu> Date: Sun, 3 Mar 2024 22:27:28 +0100 Subject: [PATCH] Migrate to zola & docker --- .dockerignore | 7 +++ .gitignore | 1 + .gitmodules | 6 --- .woodpecker.yaml | 17 +++++++ Dockerfile | 9 ++++ blog/templates/blog-page.html | 9 ++++ config.toml | 13 +++++ content/blog/_index.md | 5 ++ docker-compose.yaml | 11 +++++ index.html | 6 +-- sass/ui.scss | 89 +++++++++++++++++++++++++++++++++++ templates/base.html | 25 ++++++++++ templates/blog-page.html | 9 ++++ templates/blog.html | 13 +++++ templates/index.html | 31 ++++++++++++ 15 files changed, 241 insertions(+), 10 deletions(-) create mode 100644 .dockerignore create mode 100644 .gitignore delete mode 100644 .gitmodules create mode 100644 .woodpecker.yaml create mode 100644 Dockerfile create mode 100644 blog/templates/blog-page.html create mode 100644 config.toml create mode 100644 content/blog/_index.md create mode 100644 docker-compose.yaml create mode 100644 sass/ui.scss create mode 100644 templates/base.html create mode 100644 templates/blog-page.html create mode 100644 templates/blog.html create mode 100644 templates/index.html diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..4501fb9 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +public/ +README.md +.git +.woodpecker.yaml +Dockerfile +docker-compose.yaml +.gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..364fdec --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +public/ diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 1524a8d..0000000 --- a/.gitmodules +++ /dev/null @@ -1,6 +0,0 @@ -[submodule "blog/themes/manis"] - path = blog/themes/manis - url = https://github.com/yursan9/manis-hugo-theme.git -[submodule "blog/themes/HugoTex"] - path = blog/themes/HugoTex - url = https://github.com/kaisugi/HugoTeX diff --git a/.woodpecker.yaml b/.woodpecker.yaml new file mode 100644 index 0000000..9da76ab --- /dev/null +++ b/.woodpecker.yaml @@ -0,0 +1,17 @@ +steps: + - name: publish_image + image: woodpeckerci/plugin-docker-buildx + settings: + repo: git.gnous.eu/${CI_REPO_OWNER}/website + dockerfile: Dockerfile + platforms: linux/amd64 + registry: https://git.gnous.eu + tag: ${CI_COMMIT} + username: + from_secret: docker_username + password: + from_secret: docker_password + when: + branch: ${CI_REPO_DEFAULT_BRANCH} + event: push + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ee87b3e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM ghcr.io/getzola/zola:v0.18.0 as zola + +COPY . /project +WORKDIR /project +RUN ["zola", "build"] + +FROM ghcr.io/static-web-server/static-web-server:2.27 +WORKDIR / +COPY --from=zola /project/public /public \ No newline at end of file diff --git a/blog/templates/blog-page.html b/blog/templates/blog-page.html new file mode 100644 index 0000000..29074f2 --- /dev/null +++ b/blog/templates/blog-page.html @@ -0,0 +1,9 @@ +{% extends "base.html" %} + +{% block content %} +<h1 class="title"> + {{ page.date }} {{ page.title }} +</h1> +<p class="subtitle"><strong>{{ page.date }}</strong></p> +{{ page.content | safe }} +{% endblock content %} \ No newline at end of file diff --git a/config.toml b/config.toml new file mode 100644 index 0000000..aa32d73 --- /dev/null +++ b/config.toml @@ -0,0 +1,13 @@ +# The URL the site will be built for +base_url = "https://ada.wf/" + +# Whether to automatically compile all Sass files in the sass directory +compile_sass = true + +# Whether to build a search index to be used later on by a JavaScript library +#build_search_index = true + +[markdown] +# Whether to do syntax highlighting +# Theme can be customised by setting the `highlight_theme` variable to a theme supported by Zola +highlight_code = true diff --git a/content/blog/_index.md b/content/blog/_index.md new file mode 100644 index 0000000..b2898c5 --- /dev/null +++ b/content/blog/_index.md @@ -0,0 +1,5 @@ ++++ +sort_by = "date" +template = "blog.html" +page_template = "blog-page.html" ++++ \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..6d48da7 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,11 @@ +version: "3" + +services: + website: + image: git.gnous.eu/ada/website:latest + restart: always + container_name: website + read_only: true + ports: + - "80:80" + diff --git a/index.html b/index.html index 29e9fb8..090c344 100644 --- a/index.html +++ b/index.html @@ -8,11 +8,9 @@ <link rel="stylesheet" href="ui.css" /> </head> <body> - <header> - <h1>Site of a random human</h1> - </header> - + <main> + <h1>Site of a random human</h1> <h2>$ whoami</h2> <p> diff --git a/sass/ui.scss b/sass/ui.scss new file mode 100644 index 0000000..0d51454 --- /dev/null +++ b/sass/ui.scss @@ -0,0 +1,89 @@ +:root { + --main-width: 85vw; + --title-color: #ff008C; + --bg-color: white; + --text-color: #212121; + +} + +@media (prefers-color-scheme: dark) { + :root { + --bg-color: #212121; + --text-color: white; + } +} + +/* large screen */ +@media only screen and (min-width: 868px) { + :root { + --main-width: 50vw; + } +} + + +html { + font-family: system-ui; + scroll-behavior: smooth; + color: var(--text-color); +} + +body { + max-width: var(--main-width); + margin-left: auto; + margin-right: auto; + background-color: var(--bg-color); + line-height: 1.65; +} + +h3 { + font-size: 24px; + font-weight: normal; + color: var(--title-color); + margin-bottom: 2px; + margin-top: 0px; + a:hover { + margin-left: 4px; + text-decoration: solid underline 3px; + } + +} + +a { + color: dodgerblue; + text-decoration: none; + transition: ease 250ms; + font-weight: 600; +} + +a:hover { + color: var(--title-color); + text-decoration: underline; +} + +a:visited { + color: var(--title-color); +} + +h1, h2 { + margin-bottom: 2px; + font-weight: 600; + color: var(--title-color) +} + +h1 { + font-size: 40px; + line-height: 2; +} + +h2 { + font-size: 32px; +} + +header { + text-align: center; + p { + font-size: 20px; + font-weight: 600px; + word-spacing: 3px; + } +} \ No newline at end of file diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 0000000..aa599e7 --- /dev/null +++ b/templates/base.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<html lang="fr"> + +<head> + <meta charset="utf-8"> + <title>Ada blog</title> + <link rel="stylesheet" href="/ui.css"> +</head> + +<body> + <section class="section"> + <div class="container"> + <header> + <p> + <a href="/">Home</a> + | + <a href="/blog">blog</a> + </p> + </header> + {% block content %} {% endblock %} + </div> + </section> +</body> + +</html> \ No newline at end of file diff --git a/templates/blog-page.html b/templates/blog-page.html new file mode 100644 index 0000000..29074f2 --- /dev/null +++ b/templates/blog-page.html @@ -0,0 +1,9 @@ +{% extends "base.html" %} + +{% block content %} +<h1 class="title"> + {{ page.date }} {{ page.title }} +</h1> +<p class="subtitle"><strong>{{ page.date }}</strong></p> +{{ page.content | safe }} +{% endblock content %} \ No newline at end of file diff --git a/templates/blog.html b/templates/blog.html new file mode 100644 index 0000000..1f931bb --- /dev/null +++ b/templates/blog.html @@ -0,0 +1,13 @@ +{% extends "base.html" %} + +{% block content %} +<h1 class="title"> + {{ section.title }} +</h1> +<ul> + <!-- If you are using pagination, section.pages will be empty. You need to use the paginator object --> + {% for page in section.pages %} + <li><a href="{{ page.permalink | safe }}">{{ page.title }}</a></li> + {% endfor %} +</ul> +{% endblock content %} \ No newline at end of file diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..9199cba --- /dev/null +++ b/templates/index.html @@ -0,0 +1,31 @@ +{% extends "base.html" %} + +{% block content %} +<header> + <h1>Site of a random human</h1> +</header> + +<main> + <h2>$ whoami</h2> + + <p> + I am currently a student in security. I spend my time to make a useless network and system infrastructure. I love free software (!=opensource). + </p> + + <h2>$ ls Project</h2> + + <h3>Homelab</h3> + <p>A small lab to learn network and system. I use Proxmox in bare-metal and Ubuntu for my virtual machines. I + automate some task with Ansible.</p> + <h3><a href="https://git.gnous.eu/gnouseu/plakken">Plakken</a></h3> + <p>A web paste (like hastebin) written in go</p> + <h3><a href="https://ilearned.eu">I Learned</a></h3> + <p>A dead collaborative blog</p> +</main> + +<footer> + <p>If you want to contact me, i y have a mail ada @ gnous.eu. I have some useless project on my <a href="https://github.com/r4iponce">Github</a> and <a href="https://git.gnous.eu/ada">Gitea</a></p> +</footer> +</body> + +{% endblock content %} \ No newline at end of file