add docker image
This commit is contained in:
		
							parent
							
								
									7f2bcadfdc
								
							
						
					
					
						commit
						0521451544
					
				
							
								
								
									
										47
									
								
								.gitea/workflows/docker_build.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								.gitea/workflows/docker_build.yml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,47 @@
 | 
			
		||||
name: Build apigo
 | 
			
		||||
 | 
			
		||||
on:
 | 
			
		||||
  push:
 | 
			
		||||
    tags:
 | 
			
		||||
      - "v*"
 | 
			
		||||
 | 
			
		||||
env:
 | 
			
		||||
  IMAGE_NAME: apigo.cc/ag/apigo:${{ gitea.ref_name }}
 | 
			
		||||
  IMAGE_LATEST: apigo.cc/ag/apigo:latest
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  build:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    container:
 | 
			
		||||
      image: apigo.cc/ag/ag:latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Build
 | 
			
		||||
        run: |
 | 
			
		||||
          mkdir apigo
 | 
			
		||||
          cd apigo
 | 
			
		||||
          sed -i "s/version: v0.0.1/version: ${{ gitea.ref_name }}/" apigo.yml
 | 
			
		||||
          sed -i "s#Hello world#please mount app in /app/main.js, example: docker run --rm -it -v /your/app:/app apigo.cc/ag/apigo#" main.js
 | 
			
		||||
          ag i
 | 
			
		||||
          ag b
 | 
			
		||||
          upx build/apigo_linux_amd64
 | 
			
		||||
          docker build -t ${{ env.IMAGE_NAME }} -t ${{ env.IMAGE_LATEST }} .
 | 
			
		||||
          echo "${{ secrets.DOCKERPUSHKEY }}" | docker login apigo.cc -u "${{ gitea.actor }}" --password-stdin
 | 
			
		||||
          docker push ${{ env.IMAGE_NAME }}
 | 
			
		||||
          docker push ${{ env.IMAGE_LATEST }}
 | 
			
		||||
          docker logout apigo.cc
 | 
			
		||||
 | 
			
		||||
      - name: Send notification
 | 
			
		||||
        if: always()
 | 
			
		||||
        run: |
 | 
			
		||||
          BUILD_URL="https://apigo.cc/${{ gitea.repository }}/actions/runs/${{ gitea.run_id }}"
 | 
			
		||||
          if [ "${{ success() }}" = "true" ]; then
 | 
			
		||||
            CONTENT="✅发布并测试成功: ${{ env.REPO_NAME }}@${{ env.VERSION_TAG }}\n镜像: ${{ env.IMAGE_NAME }}\n构建地址: ${BUILD_URL}"
 | 
			
		||||
          else
 | 
			
		||||
            CONTENT="🚨发布并测试失败: ${{ env.REPO_NAME }}@${{ env.VERSION_TAG }}\n构建地址: ${BUILD_URL}"
 | 
			
		||||
          fi
 | 
			
		||||
          echo $CONTENT
 | 
			
		||||
 | 
			
		||||
          TIMESTAMP=$(date +%s)000
 | 
			
		||||
          STRING_TO_SIGN=$(printf "%s\n%s" "$TIMESTAMP" "${{ secrets.DINGSECRET }}")
 | 
			
		||||
          SIGN=$(echo -n "$STRING_TO_SIGN" | openssl dgst -sha256 -hmac "${{ secrets.DINGSECRET }}" -binary | base64 | tr -d '\n' | sed -e 's/+/%2B/g' -e 's/\//%2F/g' -e 's/=/%3D/g')
 | 
			
		||||
          curl -s -X POST "${{ secrets.DINGURL }}×tamp=${TIMESTAMP}&sign=${SIGN}" -H "Content-Type: application/json" -d "{\"msgtype\": \"text\",\"text\": {\"content\": \"${CONTENT}\"}}"
 | 
			
		||||
							
								
								
									
										11
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,11 @@
 | 
			
		||||
.*
 | 
			
		||||
!.gitignore
 | 
			
		||||
!.gitea
 | 
			
		||||
go.sum
 | 
			
		||||
/env.yml
 | 
			
		||||
/tests
 | 
			
		||||
/node_modules
 | 
			
		||||
/package.json
 | 
			
		||||
/package-lock.json
 | 
			
		||||
/build
 | 
			
		||||
/release
 | 
			
		||||
							
								
								
									
										5
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,5 @@
 | 
			
		||||
FROM alpine:latest
 | 
			
		||||
COPY build/apigo_linux_amd64 /usr/local/bin/apigo
 | 
			
		||||
COPY main.js /app/
 | 
			
		||||
workdir /app
 | 
			
		||||
entrypoint ["apigo"]
 | 
			
		||||
							
								
								
									
										10
									
								
								apigo.yml
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								apigo.yml
									
									
									
									
									
								
							@ -1,7 +1,7 @@
 | 
			
		||||
name:
 | 
			
		||||
version: v0.0.1
 | 
			
		||||
main: main.js
 | 
			
		||||
#goproxy: https://goproxy.cn,direct
 | 
			
		||||
goproxy: https://goproxy.cn,direct
 | 
			
		||||
target:
 | 
			
		||||
  darwin: amd64 arm64
 | 
			
		||||
  linux: amd64 arm64
 | 
			
		||||
@ -13,6 +13,14 @@ module:
 | 
			
		||||
  apigo.cc/gojs/file: latest
 | 
			
		||||
  apigo.cc/gojs/http: latest
 | 
			
		||||
  apigo.cc/gojs/db: latest
 | 
			
		||||
  apigo.cc/gojs/office: latest
 | 
			
		||||
  apigo.cc/gojs/task: latest
 | 
			
		||||
  apigo.cc/gojs/mail: latest
 | 
			
		||||
  apigo.cc/gojs/img: latest
 | 
			
		||||
  apigo.cc/gojs/redis: latest
 | 
			
		||||
  apigo.cc/gojs/runtime: latest
 | 
			
		||||
  apigo.cc/gojs/service: latest
 | 
			
		||||
  apigo.cc/gojs/client: latest
 | 
			
		||||
modulealias:
 | 
			
		||||
extraimport:
 | 
			
		||||
cachefile:
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user