From 46696aaf03b14b642ba6be8bd12a3b4b64ed31db Mon Sep 17 00:00:00 2001 From: James Mills <1290234+prologic@users.noreply.github.com> Date: Sat, 11 Mar 2023 16:55:59 +1000 Subject: [PATCH] Add better layout, fixed Drone CI and dpeloyed to zs.mills.io --- .dockerfiles/entrypoint.sh | 10 ++++++++++ .dockerignore | 2 +- .drone.yml | 32 +++++++++++++++++++++++++------- .zs/layout.html | 10 +++++++--- COPYING | 4 ++++ Dockerfile | 25 ++++++++++++++++++++----- LICENSE | 14 +++++++++----- Makefile | 18 ++++++++++-------- index.md | 31 +++++++++++++++++++++++++++---- 9 files changed, 113 insertions(+), 33 deletions(-) create mode 100755 .dockerfiles/entrypoint.sh create mode 100644 COPYING diff --git a/.dockerfiles/entrypoint.sh b/.dockerfiles/entrypoint.sh new file mode 100755 index 0000000..a412db5 --- /dev/null +++ b/.dockerfiles/entrypoint.sh @@ -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 "$@" diff --git a/.dockerignore b/.dockerignore index abe986f..0df1878 100644 --- a/.dockerignore +++ b/.dockerignore @@ -6,4 +6,4 @@ /README.md /.drone.yml /.gitignore -/.dockerignore +/.dockerignore \ No newline at end of file diff --git a/.drone.yml b/.drone.yml index d1dcb17..6e68916 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,21 +1,39 @@ --- kind: pipeline -name: default +name: 🐳 Docker steps: - - name: build-image-push + - name: 📦 Image image: plugins/kaniko settings: - registry: - repo: // + repo: r.mills.io/prologic/zs tags: latest username: - from_secret: + from_secret: registry_username password: - from_secret: + 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 diff --git a/.zs/layout.html b/.zs/layout.html index 3912c77..6c08173 100644 --- a/.zs/layout.html +++ b/.zs/layout.html @@ -8,15 +8,19 @@ {{ title }} + + + - {{ content }} +
{{ content }}

- +

+ Copyright (c) James Mills · Last modified · Built with zs - +

diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..4e51a24 --- /dev/null +++ b/COPYING @@ -0,0 +1,4 @@ +Copyright © 2023 James Mills +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. diff --git a/Dockerfile b/Dockerfile index 2b5da4b..ce19e0e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] diff --git a/LICENSE b/LICENSE index 2071b23..5c93f45 100644 --- a/LICENSE +++ b/LICENSE @@ -1,9 +1,13 @@ -MIT License + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 -Copyright (c) + Copyright (C) 2004 Sam Hocevar -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. diff --git a/Makefile b/Makefile index 228a25c..40a1463 100644 --- a/Makefile +++ b/Makefile @@ -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= -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: diff --git a/index.md b/index.md index 6cdff97..1df9984 100644 --- a/index.md +++ b/index.md @@ -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) \ No newline at end of file