diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9bc99fa --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM alpine:latest + +RUN apk add --no-cache \ + brotli \ + gzip \ + hugo + +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] + diff --git a/README.md b/README.md index bb2c622..c910951 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,7 @@ # Forgejo-Action for building hugo pages +This Action builds a hugo site and runs both gzip and brotli on static text files so a properly configured webbrowser can serve those precompressed files + +The compression only works on files in the "public" folder of the actions workdir. + + diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..2250b0f --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +hugo +find ./public -type f \ + -regex ".*\.\(css\|html\|js\|json\|svg\|xml\)$" \ + -exec brotli --best -f {} \+ \ + -exec gzip --best -k -f {} \+