Add better layout, fixed Drone CI and dpeloyed to zs.mills.io

This commit is contained in:
James Mills 2023-03-11 16:55:59 +10:00
parent f66dbadf21
commit 46696aaf03
No known key found for this signature in database
GPG Key ID: AC4C014F1440EBD6
9 changed files with 113 additions and 33 deletions

10
.dockerfiles/entrypoint.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
[ -n "${PUID}" ] && usermod -u "${PUID}" mpp
[ -n "${PGID}" ] && groupmod -g "${PGID}" mpp
printf "Configuring mpp...\n"
npx react-inject-env set -d /data
printf "Switching UID=%s and GID=%s\n" "${PUID}" "${PGID}"
exec su-exec mpp:mpp "$@"

View File

@ -6,4 +6,4 @@
/README.md
/.drone.yml
/.gitignore
/.dockerignore
/.dockerignore

View File

@ -1,21 +1,39 @@
---
kind: pipeline
name: default
name: 🐳 Docker
steps:
- name: build-image-push
- name: 📦 Image
image: plugins/kaniko
settings:
registry: <register>
repo: <register>/<user>/<image>
repo: r.mills.io/prologic/zs
tags: latest
username:
from_secret: <regsitry_username>
from_secret: registry_username
password:
from_secret: <registry_password>
from_secret: registry_password
when:
branch:
- main
event:
- push
---
kind: pipeline
name: 🥳 Done
steps:
- name: 🔔 Notify
image: plugins/webhook
settings:
urls:
- https://msgbus.mills.io/ci.mills.io
depends_on:
- 🐳 Docker
trigger:
branch:
- master
- main
event:
- push

View File

@ -8,15 +8,19 @@
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<title>{{ title }}</title>
<meta name="title" content="{{ title }}" />
<meta name="description" content="{{ description }}" />
<meta name="keywords" content="{{ keywords }}" />
</head>
<body>
{{ content }}
<main>{{ content }}</main>
<hr />
<footer>
<small>
<p>
Copyright (c) James Mills ·
Last modified <time datetime="{{ date +%Y-%m-%dT%H:%M:%SZ%:z }}">{{ date }}</time> ·
Built with <a href="https://git.mills.io/prologic/zs">zs
</small>
</p>
</footer>
</body>
</html>

4
COPYING Normal file
View File

@ -0,0 +1,4 @@
Copyright © 2023 James Mills <prologic@shortcircuit.net.au>
This work is free. You can redistribute it and/or modify it under the
terms of the Do What The Fuck You Want To Public License, Version 2,
as published by Sam Hocevar. See the COPYING file for more details.

View File

@ -22,13 +22,28 @@ COPY . .
RUN make build
# Runtime
FROM scratch
FROM alpine AS runtime
RUN apk --no-cache -U add su-exec shadow
ENV PUID=10000
ENV PGID=10000
RUN addgroup -g "${PGID}" zs && \
adduser -D -H -G zs -h /var/empty -u "${PUID}" zs && \
mkdir -p /data && chown -R zs:zs /data
EXPOSE 8000
WORKDIR /
VOLUME /data
COPY --from=build /go/bin/static /static
WORKDIR /
COPY --from=build /go/bin/static /usr/local/bin/static
COPY --from=build /src/.pub /data
ENTRYPOINT ["/static"]
CMD ["-r", "/data"]
COPY .dockerfiles/entrypoint.sh /init
ENTRYPOINT ["/init"]
CMD ["static", "-n", "-s", "-r", "/data"]

14
LICENSE
View File

@ -1,9 +1,13 @@
MIT License
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (c) <year> <copyright holders>
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0. You just DO WHAT THE FUCK YOU WANT TO.

View File

@ -1,9 +1,8 @@
-include environ.inc
.PHONY: deps dev build install image release test clean
.PHONY: deps dev build image clean
GOCMD=go
REGISTRY=<registry>
IMAGE=<image>
IMAGE := r.mills.io/prologic/zs
TAG := latest
all: build
@ -13,18 +12,21 @@ deps:
dev : DEBUG=1
dev : build
@zs watch
@bash -c 'trap "jobs -p | xargs kill" EXIT; \
zs watch & \
static -r .pub & \
echo http://localhost:8000/; \
wait'
build:
@zs build
ifeq ($(PUBLISH), 1)
image:
@docker build -t $(REGISTRY)/$(IMAGE) .
@docker push $(REGISTRY)/$(IMAGE)
@docker buildx build --platform linux/amd64,linux/arm64 --push -t $(IMAGE):$(TAG) .
else
image:
@docker build -t $(REGISTRY)/$(IMAGE) .
@docker build -t $(IMAGE):$(TAG) .
endif
clean:

View File

@ -1,9 +1,32 @@
# zs starter tempalte
---
title: zs starter template
description: A starter template for the Zen Static (zs) site generator
keywords: zen, static, zs, starter, template, site, website, template, generator, ssg
---
# zs starter template
This is a [zs](https://git.mills.io/prologic/zs) starter template.
It includes:
- A basic `index.md` content
- A basic "layout"
- A basic CSS for styling
- A basic index page
- A basic layout using [SimpleCSS](https://simplecss.org/) for style
## Quick Start
```console
git clone https://git.mills.io/prologic/zs.git
cd zs
make dev
```
Open your browser to http://localhost:8000
## Demo
A demo of this starter template can be found here: https://zs.mills.io/
## License
`zs-starter-template` is licensed under the terms of the [WTFPL License](/LICENSE)