You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
1.8 KiB

1 month ago
kind: pipeline
1 month ago
type: docker
1 month ago
name: default
1 month ago
1 month ago
volumes:
1 month ago
- name: docker-sock
host:
1 month ago
path: /var/run/docker.sock
1 month ago
- name: shared-folder
1 month ago
host:
1 month ago
path: /root/app/drone/workspace
1 month ago
- name: go-cache
host:
path: /root/app/drone/go-cache
1 month ago
1 month ago
clone:
disable: true
1 month ago
steps:
- name: clone
1 month ago
image: alpine/git:latest
1 month ago
pull: never
1 month ago
volumes:
1 month ago
- name: shared-folder
path: /workspace
1 month ago
commands:
1 month ago
- cd /workspace
1 month ago
- pwd
1 month ago
- git clone http://47.112.165.44:3000/seekm/prdUploader.git
1 month ago
1 month ago
- name: build
image: golang:1.21-alpine
pull: never
environment:
GO111MODULE: on
CGO_ENABLED: 0
GOPROXY: https://goproxy.cn
GOMODCACHE: /go/pkg/mod
volumes:
- name: shared-folder
path: /workspace
- name: go-cache
path: /go/pkg/mod
commands:
- echo "Building binary..."
- cd /workspace/prdUploader
- pwd
- echo $GOMODCACHE
- go mod tidy
- go build -o myapp -ldflags "-X main.RunMode=test -s -w"
- echo "Building binary finished"
- ls -lh myapp
1 month ago
- name: deploy
1 month ago
image: docker:24.0-cli
1 month ago
pull: never
volumes:
- name: shared-folder
path: /workspace
1 month ago
- name: docker-sock
1 month ago
path: /var/run/docker.sock
1 month ago
commands:
4 weeks ago
- echo "Checking for running container..."
4 weeks ago
- |
docker ps --filter "ancestor=prduploader:latest" -q | xargs -I {} docker stop {} && docker rm {}
4 weeks ago
- echo "Building Docker image..."
- cd /workspace/prdUploader
- docker rmi prduploader:latest || true
- docker build -t prduploader:latest .
- echo "Running Docker container..."
- docker run -d -p 11000:11000 prduploader:latest
- echo "Deployment finished"
- cd ..
- rm -rf prdUploader