buildcache (#159)

questo ci permette di ridurre parecchio il tempo di una build, mettendo in cache le risorse elaborate (principalmente le immagini e le relative versioni scalate)

Reviewed-on: BgLUG/bglug.it#159
Co-authored-by: paspo <paolo@asperti.com>
Co-committed-by: paspo <paolo@asperti.com>
This commit is contained in:
Paolo Asperti 2024-07-28 09:49:36 +00:00 committed by Paolo Asperti
parent f910647729
commit c4665c4b8d
3 changed files with 19 additions and 11 deletions

View File

@ -1,3 +0,0 @@
public/
resources/
.hugo_build.lock

View File

@ -19,6 +19,24 @@ jobs:
submodules: true # Fetch Hugo themes (true OR recursive)
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- uses: actions/cache/restore@v4
with:
path: |
resources
key: bglug-it-hugo-resources
- name: Build Hugo
uses: lowply/build-hugo@v0.129.0
with:
args: --gc --minify --cleanDestinationDir
- uses: actions/cache/save@v4
if: always() # salva in cache anche se la build fallisce
with:
path: |
resources
key: bglug-it-hugo-resources
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

View File

@ -1,10 +1,3 @@
FROM git.libreschool.org/bglug/hugo-extended:latest AS hugobuild
COPY . /src
RUN \
hugo -s /src --gc --minify
FROM alpine:latest
RUN \
@ -15,7 +8,7 @@ RUN \
chmod -R a-x,a=rX,ug+w /wwwroot /logs
COPY docker/rootfs /
COPY --from=hugobuild --chown=nginx:www-data --chmod=a-x,a=rX,ug+w /src/public /wwwroot/
COPY --chown=nginx:www-data --chmod=a-x,a=rX,ug+w public/ /wwwroot/
# config test
RUN nginx -t