48 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			48 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
| ---
 | |
| kind: pipeline
 | |
| type: docker
 | |
| name: main
 | |
| 
 | |
| trigger:
 | |
|   branch:
 | |
|     - master
 | |
| 
 | |
| steps:
 | |
|   - name: prepare
 | |
|     image: docker:latest
 | |
|     volumes:
 | |
|       - name: docker-socket
 | |
|         path: /var/run/docker.sock
 | |
|     commands:
 | |
|       - echo 'http://dl-cdn.alpinelinux.org/alpine/edge/community' > /etc/apk/repositories
 | |
|       - apk update
 | |
|       - apk add git yq
 | |
|       - git clone https://github.com/drone/drone.git .
 | |
|       - LATEST_VERSION=$(git tag --sort v:refname | grep '^v[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}$' | tail -n 1)
 | |
|       - git checkout $LATEST_VERSION
 | |
|       - GOLANG_IMG=$(yq read .drone.yml 'steps[0].image')
 | |
|       - docker pull $GOLANG_IMG
 | |
|       - docker tag $GOLANG_IMG drone-builder:latest
 | |
|       - docker image rm $GOLANG_IMG
 | |
|   
 | |
|   - name: compile
 | |
|     image: drone-builder:latest
 | |
|     environment:
 | |
|       GOARCH: amd64
 | |
|       GOOS: linux
 | |
|     commands:
 | |
|       - go build -ldflags "-extldflags \"-static\"" -tags nolimit -o release/linux/amd64/drone-server github.com/drone/drone/cmd/drone-server
 | |
| 
 | |
|   - name: docker-build
 | |
|     image: docker:latest
 | |
|     volumes: 
 | |
|       - name: docker-socket
 | |
|         path: /var/run/docker.sock
 | |
|     commands:
 | |
|       - docker build -t registry.jfmonty2.com/drone:latest -f docker/Dockerfile.server.linux.amd64 .
 | |
| 
 | |
| 
 | |
| volumes:
 | |
|   - name: docker-socket
 | |
|     host:
 | |
|       path: /var/run/docker.sock |