更新 .gitea/workflows/main.yaml
This commit is contained in:
parent
061dc289c8
commit
5d27be58b9
|
@ -11,8 +11,11 @@ jobs:
|
||||||
runs-on: runner
|
runs-on: runner
|
||||||
env:
|
env:
|
||||||
HOST_PORT: 8080
|
HOST_PORT: 8080
|
||||||
|
REGISTRY: "${{REGISTRY}}"
|
||||||
|
REPO: "${{REPO}}"
|
||||||
CTN_NAME: "ctn-pms-demo"
|
CTN_NAME: "ctn-pms-demo"
|
||||||
IMG_NAME: "${{ github.repository }}:${{ github.ref_name }}"
|
IMG_NAME: "${{ github.repository }}:${{ github.ref_name }}"
|
||||||
|
REMOTE_IMG_NAME: "${{REGISTRY}}/${{REPO}}/${{ github.repository }}:${{ github.ref_name }}"
|
||||||
steps:
|
steps:
|
||||||
- name: install nodejs&golang and set proxy
|
- name: install nodejs&golang and set proxy
|
||||||
run: |
|
run: |
|
||||||
|
@ -29,32 +32,36 @@ jobs:
|
||||||
# uses: actions/setup-go@v4
|
# uses: actions/setup-go@v4
|
||||||
# with:
|
# with:
|
||||||
# go-version: '1.22'
|
# go-version: '1.22'
|
||||||
|
- name: Checkout Repo
|
||||||
- uses: http://${{vars.DOMAIN}}:5678/actions/checkout@v4
|
- uses: http://${{vars.DOMAIN}}:5678/actions/checkout@v4
|
||||||
|
|
||||||
- name: Login to Alibaba Cloud Docker Registry
|
- name: Login to Alibaba Cloud Docker Registry
|
||||||
uses: http://${{vars.DOMAIN}}:5678/docker/login-action@v2
|
uses: http://${{vars.DOMAIN}}:5678/docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: registry.cn-hangzhou.aliyuncs.com
|
registry: $REGISTRY
|
||||||
username: ${{ vars.DOCKER_USERNAME }}
|
username: ${{ vars.DOCKER_USERNAME }}
|
||||||
password: ${{ vars.DOCKER_TOKEN }}
|
password: ${{ vars.DOCKER_TOKEN }}
|
||||||
|
|
||||||
- name: Build Image
|
- name: Remove Container & Image
|
||||||
run: |
|
run: |
|
||||||
docker stop $CTN_NAME || true
|
docker stop $CTN_NAME || true
|
||||||
docker rm $CTN_NAME || true
|
docker rm $CTN_NAME || true
|
||||||
docker rmi $IMG_NAME || true
|
docker rmi $REMOTE_IMG_NAME || true
|
||||||
docker build -t $IMG_NAME . --file Dockerfile
|
# docker build -t $REMOTE_IMG_NAME . --file Dockerfile
|
||||||
|
|
||||||
|
- name: Build and Push Docker Image To Alibaba Cloud
|
||||||
# - name: Build and Push Docker Image
|
uses: docker/build-push-action@v6
|
||||||
# uses: docker/build-push-action@v6
|
with:
|
||||||
# with:
|
push: true
|
||||||
# push: true
|
build:
|
||||||
# tags: ${{ vars.DOCKER_USERNAME }}/$IMG_NAME:latest
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
tags: REMOTE_IMG_NAME
|
||||||
|
# username: ${{ vars.DOCKER_USERNAME }}
|
||||||
|
# password: ${{ vars.DOCKER_TOKEN }}
|
||||||
- name: Run On Server
|
- name: Run On Server
|
||||||
run: |
|
run: |
|
||||||
docker run -d --name $CTN_NAME -p $HOST_PORT:8080 $IMG_NAME
|
docker run -d --name $CTN_NAME -p $HOST_PORT:8080 $REMOTE_IMG_NAME
|
||||||
# - name: SSH Deploy
|
# - name: SSH Deploy
|
||||||
# uses: easingthemes/ssh-deploy-action@v2.1.5
|
# uses: easingthemes/ssh-deploy-action@v2.1.5
|
||||||
# env:
|
# env:
|
||||||
|
|
Loading…
Reference in New Issue