Refactor Docker deployment process to use Buildx for improved image building and caching
Some checks failed
Build and Deploy Blog / build-and-deploy-local (push) Has been cancelled

This commit is contained in:
2026-03-31 02:53:50 +02:00
parent 1ba5ee1b41
commit b5337d9b3f
2 changed files with 23 additions and 8 deletions

View File

@@ -1,6 +1,6 @@
node_modules node_modules
.next .next
Dockerfile
.git .git
.gitignore .gitea
*.mdx *.md
.env*

View File

@@ -14,10 +14,25 @@ jobs:
- name: Checkout Code - name: Checkout Code
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Rebuild and Deploy with Docker Compose - name: Set up Docker Buildx
run: | uses: docker/setup-buildx-action@v3
docker build --target release -t local/gabriel-blog:latest .
docker compose up -d
# Clean up any old, unused images to save disk space - name: Build image
uses: docker/build-push-action@v5
with:
context: .
target: release
tags: local/gabriel-blog:latest
load: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
- name: Rotate cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Deploy and cleanup
run: |
docker compose up -d
docker image prune -f docker image prune -f