36 lines
859 B
YAML
36 lines
859 B
YAML
name: 打包发布docker镜像
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
|
|
jobs:
|
|
build-push:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: 拉取代码🔄
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx🔧
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: 打包并发布镜像📦
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
tags: registry.fandouke.com/test-image:latest
|
|
push: true
|
|
|
|
- name: 部署到远程服务器🚀
|
|
uses: appleboy/ssh-action@v1.0.3
|
|
with:
|
|
host: ${{ secrets.REMOTE_HOST }}
|
|
username: ${{ secrets.REMOTE_USER }}
|
|
password: ${{ secrets.REMOTE_PASSWORD }}
|
|
script: |
|
|
pwd
|
|
docker-compose down || true
|
|
docker-compose up -d
|
|
|
|
|