省略镜像传输过程
This commit is contained in:
parent
ab3548837a
commit
39abb1974d
@ -21,27 +21,11 @@ jobs:
|
|||||||
docker build -t awesome-index:${{ github.sha }} .
|
docker build -t awesome-index:${{ github.sha }} .
|
||||||
docker tag awesome-index:${{ github.sha }} awesome-index:latest
|
docker tag awesome-index:${{ github.sha }} awesome-index:latest
|
||||||
|
|
||||||
- name: Save Docker image
|
|
||||||
run: |
|
|
||||||
docker save awesome-index:latest | gzip > awesome-index.tar.gz
|
|
||||||
|
|
||||||
- name: Upload artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: docker-image
|
|
||||||
path: awesome-index.tar.gz
|
|
||||||
retention-days: 1
|
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
needs: build
|
needs: build
|
||||||
if: github.ref == 'refs/heads/main'
|
if: github.ref == 'refs/heads/main'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Download artifact
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: docker-image
|
|
||||||
|
|
||||||
- name: Deploy to server
|
- name: Deploy to server
|
||||||
uses: appleboy/ssh-action@master
|
uses: appleboy/ssh-action@master
|
||||||
with:
|
with:
|
||||||
@ -70,10 +54,6 @@ jobs:
|
|||||||
script: |
|
script: |
|
||||||
cd /app/awesome
|
cd /app/awesome
|
||||||
|
|
||||||
# 加载镜像
|
|
||||||
gunzip -c awesome-index.tar.gz | docker load || true
|
|
||||||
rm -f awesome-index.tar.gz
|
|
||||||
|
|
||||||
# 停止旧容器
|
# 停止旧容器
|
||||||
docker compose down --remove-orphans 2>/dev/null || true
|
docker compose down --remove-orphans 2>/dev/null || true
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user