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:
@@ -1,6 +1,6 @@
|
|||||||
node_modules
|
node_modules
|
||||||
.next
|
.next
|
||||||
Dockerfile
|
|
||||||
.git
|
.git
|
||||||
.gitignore
|
.gitea
|
||||||
*.mdx
|
*.md
|
||||||
|
.env*
|
||||||
|
|||||||
@@ -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
|
||||||
Reference in New Issue
Block a user