add drone, test many events
continuous-integration/drone/push Build is failing Details

This commit is contained in:
user-penguin 2024-11-09 22:58:14 +07:00
parent d566529a90
commit 8ec0e604ce
3 changed files with 70 additions and 0 deletions

56
.drone.yml Normal file
View File

@ -0,0 +1,56 @@
kind: pipeline
type: docker
name: default
steps:
- name: build
image: golang:1.23
commands:
- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o smm_core cmd/smm_core/main.go
- name: test
image: golang:1.23
commands:
- go test ./...
- name: scp
image: appleboy/drone-scp
settings:
host:
from_secret: server_ip
username:
from_secret: ssh_user
key:
from_secret: ssh_key
port:
from_secret: ssh_port
target:
- deploys/smm_core
source:
- resources
- smm_core
- docker-compose.yml
- Dockerfile
rm: true
- name: deploy
image: appleboy/drone-ssh
settings:
host:
from_secret: server_ip
username:
from_secret: ssh_user
key:
from_secret: ssh_key
port:
from_secret: ssh_port
command_timeout: 10s
script:
- cd deploys/smm_core
- docker-compose up -d --build --force-recreate
trigger:
event:
- push
- tag

5
Dockerfile Normal file
View File

@ -0,0 +1,5 @@
FROM 1.23.3-alpine3.19
COPY smm_core /usr/local/bin/smm_core
COPY resources /go/resources
RUN chmod +x /usr/local/bin/smm_core
CMD ["smm_core"]

9
docker-compose.yaml Normal file
View File

@ -0,0 +1,9 @@
version: '3.8'
services:
smm_core:
build:
context: .
dockerfile: Dockerfile
ports:
- "8180:8090"