Compare commits
10 Commits
59d39de81e
...
b3d2a3ac28
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b3d2a3ac28 | ||
|
|
327e916040 | ||
|
|
976ac2017e | ||
|
|
4bf490e822 | ||
|
|
cede6926e5 | ||
|
|
fda46905d8 | ||
|
|
a292289e79 | ||
|
|
0a30bacb54 | ||
|
|
fcfddbafa9 | ||
|
|
f7607794b9 |
33
.github/workflows/docker-build.yml
vendored
33
.github/workflows/docker-build.yml
vendored
@ -7,23 +7,32 @@ jobs:
|
|||||||
build-push:
|
build-push:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: 拉取代码🔄
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx🔧
|
||||||
uses: docker/setup-buildx-action@v4
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Login to Docker Registry
|
- name: 打包并发布镜像📦
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: your-registry.com # 替换为自建 Registry 的地址
|
|
||||||
username: ${{ secrets.DOCKER_USER }}
|
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
|
|
||||||
- name: Build and push Docker image
|
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./Dockerfile # 指定 Dockerfile 路径
|
file: ./Dockerfile # 指定 Dockerfile 路径
|
||||||
tags: your-registry.com/your-image:latest # 镜像标签(包含 Registry 地址)
|
tags: registry.fandouke.com/test-image:latest # 镜像标签(包含 Registry 地址)
|
||||||
push: true
|
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 stop test-container || true
|
||||||
|
docker rm test-container || true
|
||||||
|
docker run -d --name test-container \
|
||||||
|
-p 5321:5000 \
|
||||||
|
registry.fandouke.com/test-image:latest
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
FROM python:3.10-alpine
|
FROM python:3.10-alpine
|
||||||
|
|
||||||
RUN pip install -r requirements.txt
|
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
|
RUN pip install -r requirements.txt
|
||||||
|
|
||||||
CMD ["python", "main.py"]
|
CMD ["python", "main.py"]
|
||||||
Loading…
x
Reference in New Issue
Block a user