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