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
Some checks failed
Build and Deploy Blog / build-and-deploy-local (push) Has been cancelled
This commit is contained in:
@@ -14,10 +14,25 @@ jobs:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Rebuild and Deploy with Docker Compose
|
||||
run: |
|
||||
docker build --target release -t local/gabriel-blog:latest .
|
||||
docker compose up -d
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
# 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
|
||||
Reference in New Issue
Block a user