Merge remote-tracking branch 'origin/master'
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Владимир Фёдоров 2024-05-19 18:42:39 +07:00
commit fe6d333e04
3 changed files with 73 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
commands:
- set GOOS=linux
- set GOARCH=amd64
- set CGO_ENABLED=0
- go build -a -ldflags '-extldflags "-static"' -o cake_crm cmd/cake_crm/main.go
- name: test
image: golang
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/cake_crm
source:
- cake_crm
- 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/cake_crm
- docker-compose up -d --force-recreate
trigger:
event:
- push

5
Dockerfile Normal file
View File

@ -0,0 +1,5 @@
FROM alpine:latest
RUN apk add --no-cache ca-certificates
COPY cake_crm /usr/local/bin/cake_crm
RUN chmod +x /usr/local/bin/cake_crm
CMD ["/usr/local/bin/cake_crm"]

12
docker-compose.yml Normal file
View File

@ -0,0 +1,12 @@
version: '3.8'
services:
cake_crm:
build:
context: .
dockerfile: Dockerfile
ports:
- "8080:8080"
# environment:
# - ENV_VAR_NAME=env_var_value