ci: 改为单镜像版本
This commit is contained in:
27
.github/workflows/docker-image.yml
vendored
27
.github/workflows/docker-image.yml
vendored
@@ -26,16 +26,6 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
needs: prepare
|
needs: prepare
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
service: [backend, frontend]
|
|
||||||
include:
|
|
||||||
- service: backend
|
|
||||||
context: .
|
|
||||||
- service: frontend
|
|
||||||
context: ./frontend
|
|
||||||
# 允许其中一个任务失败时,其他任务仍继续执行
|
|
||||||
fail-fast: false
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
@@ -59,7 +49,7 @@ jobs:
|
|||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
images: ${{ secrets.DOCKERHUB_USERNAME }}/stock-scanner-${{ matrix.service }}
|
images: ${{ secrets.DOCKERHUB_USERNAME }}/stock-scanner
|
||||||
tags: |
|
tags: |
|
||||||
type=raw,value=latest
|
type=raw,value=latest
|
||||||
type=raw,value=${{ needs.prepare.outputs.version }}
|
type=raw,value=${{ needs.prepare.outputs.version }}
|
||||||
@@ -67,12 +57,12 @@ jobs:
|
|||||||
- name: Build and push
|
- name: Build and push
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: ${{ matrix.context }}
|
context: .
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
cache-from: type=gha,scope=${{ matrix.service }}
|
cache-from: type=gha,scope=stock-scanner
|
||||||
cache-to: type=gha,scope=${{ matrix.service }},mode=max
|
cache-to: type=gha,scope=stock-scanner,mode=max
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
needs: [prepare, build]
|
needs: [prepare, build]
|
||||||
@@ -149,13 +139,8 @@ jobs:
|
|||||||
sleep 10
|
sleep 10
|
||||||
|
|
||||||
# 验证服务是否正常运行
|
# 验证服务是否正常运行
|
||||||
if ! curl -s http://localhost:80 > /dev/null; then
|
if ! curl -s http://localhost:8888/api/config > /dev/null; then
|
||||||
echo "前端服务未正常运行!"
|
echo "服务未正常运行!"
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! curl -s http://localhost:8888/config > /dev/null; then
|
|
||||||
echo "后端服务未正常运行!"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user