添加 GitHub Actions 工作流以支持 Docker 镜像的打包和发布,并部署到远程服务器,增强自动化流程。
Some checks failed
打包发布docker镜像 / build-push (push) Failing after 55s
Some checks failed
打包发布docker镜像 / build-push (push) Failing after 55s
This commit is contained in:
parent
5052727dc5
commit
24cf1f788b
35
.github/workflows/docker-compose-build.yml
vendored
Normal file
35
.github/workflows/docker-compose-build.yml
vendored
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
name: 打包发布docker镜像
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ docker-compose ]
|
||||||
|
|
||||||
|
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: |
|
||||||
|
docker pull registry.fandouke.com/test-image:latest
|
||||||
|
docker-compose down || true
|
||||||
|
docker-compose up -d
|
||||||
|
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user