Skip to content

Cache the other containers too #17

Cache the other containers too

Cache the other containers too #17

Workflow file for this run

name: Build blog
on:
pull_request:
push:
branches:
- "main"
# Allow this job to clone the repo and create a page deployment
permissions:
contents: read
packages: write
jobs:
build:
runs-on: ubuntu-22.04
env:
TZ: America/Chicago
steps:
- name: Checkout your repository using git
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/jordemort/jordemort-blog
- name: Cache dependencies
id: cache-dependencies
uses: actions/cache@v4
with:
key: ${{ runner.os }}-node-modules
path: node_modules
- name: Pull Kroki containers
run: docker compose pull kroki blockdiag mermaid bpmn excalidraw
- name: Build and maybe push builder
uses: docker/build-push-action@v5
with:
context: .
cache-from: type=registry,ref=ghcr.io/jordemort/jordemort-blog-builder:latest
cache-to: type=inline
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=ghcr.io/jordemort/jordemort-blog-builder:latest,push=${{ github.event_name == 'push' }}
pull: true
tags: ghcr.io/jordemort/jordemort-blog-builder:latest
target: astro
- name: Build site
run: docker compose run --rm astro npm run build
- name: Build and push dependencies
uses: docker/build-push-action@v5
if: ${{ github.event_name == 'push' }}
with:
context: .
cache-from: type=registry,ref=ghcr.io/jordemort/jordemort-blog-dependencies:latest
cache-to: type=inline
labels: ${{ steps.meta.outputs.labels }}
push: true
tags: ghcr.io/jordemort/jordemort-blog-dependencies:latest
target: dependencies
- name: Build and push site
uses: docker/build-push-action@v5
if: ${{ github.event_name == 'push' }}
with:
context: .
cache-from: type=registry,ref=ghcr.io/jordemort/jordemort-blog:latest
cache-to: type=inline
labels: ${{ steps.meta.outputs.labels }}
pull: true
push: true
tags: ghcr.io/jordemort/jordemort-blog:latest
target: site