Compare commits
1 Commits
docker-com
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef1440a915 |
22
.github/workflows/docker-build.yml
vendored
22
.github/workflows/docker-build.yml
vendored
@ -17,19 +17,10 @@ jobs:
|
|||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./Dockerfile
|
file: ./Dockerfile # 指定 Dockerfile 路径
|
||||||
tags: registry.fandouke.com/test-image:latest
|
tags: registry.fandouke.com/test-image:latest # 镜像标签(包含 Registry 地址)
|
||||||
push: true
|
push: true
|
||||||
|
|
||||||
- name: 拷贝docker-compose文件到远程服务器📄
|
|
||||||
uses: appleboy/scp-action@v0.1.4
|
|
||||||
with:
|
|
||||||
host: ${{ secrets.REMOTE_HOST }}
|
|
||||||
username: ${{ secrets.REMOTE_USER }}
|
|
||||||
password: ${{ secrets.REMOTE_PASSWORD }}
|
|
||||||
source: "docker-compose.yml"
|
|
||||||
target: "/home/${{ secrets.REMOTE_USER }}/app"
|
|
||||||
|
|
||||||
- name: 部署到远程服务器🚀
|
- name: 部署到远程服务器🚀
|
||||||
uses: appleboy/ssh-action@v1.0.3
|
uses: appleboy/ssh-action@v1.0.3
|
||||||
with:
|
with:
|
||||||
@ -37,8 +28,11 @@ jobs:
|
|||||||
username: ${{ secrets.REMOTE_USER }}
|
username: ${{ secrets.REMOTE_USER }}
|
||||||
password: ${{ secrets.REMOTE_PASSWORD }}
|
password: ${{ secrets.REMOTE_PASSWORD }}
|
||||||
script: |
|
script: |
|
||||||
cd /home/${{ secrets.REMOTE_USER }}/app
|
docker pull registry.fandouke.com/test-image:latest
|
||||||
docker-compose down || true
|
docker stop test-container || true
|
||||||
docker-compose up -d
|
docker rm test-container || true
|
||||||
|
docker run -d --name test-container \
|
||||||
|
-p 5321:5000 \
|
||||||
|
registry.fandouke.com/test-image:latest
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
46
.github/workflows/docker-compose-build.yml
vendored
46
.github/workflows/docker-compose-build.yml
vendored
@ -1,46 +0,0 @@
|
|||||||
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: 拷贝docker-compose文件到远程服务器📄
|
|
||||||
uses: appleboy/scp-action@v0.1.4
|
|
||||||
with:
|
|
||||||
host: 8.138.188.137
|
|
||||||
port: 13502
|
|
||||||
username: ${{ secrets.REMOTE_USER }}
|
|
||||||
password: ${{ secrets.REMOTE_PASSWORD }}
|
|
||||||
source: "docker-compose.yml"
|
|
||||||
target: "/home/${{ secrets.REMOTE_USER }}/app"
|
|
||||||
|
|
||||||
- name: 部署到远程服务器🚀
|
|
||||||
uses: appleboy/ssh-action@v1.0.3
|
|
||||||
with:
|
|
||||||
host: 8.138.188.137
|
|
||||||
port: 13502
|
|
||||||
username: ${{ secrets.REMOTE_USER }}
|
|
||||||
password: ${{ secrets.REMOTE_PASSWORD }}
|
|
||||||
script: |
|
|
||||||
cd /home/${{ secrets.REMOTE_USER }}/app
|
|
||||||
docker-compose down || true
|
|
||||||
docker-compose up -d
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
FROM dockerproxy.fandouke.com/python:3.10-alpine
|
FROM python:3.10-alpine
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +0,0 @@
|
|||||||
version: '3'
|
|
||||||
services:
|
|
||||||
test-app:
|
|
||||||
image: registry.fandouke.com/test-image:latest
|
|
||||||
container_name: test-container
|
|
||||||
ports:
|
|
||||||
- "5321:5000"
|
|
||||||
restart: unless-stopped
|
|
||||||
Loading…
x
Reference in New Issue
Block a user