init app
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: default
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
pull: if-not-exists
|
||||
image: golang:1.23
|
||||
environment:
|
||||
TELEGRAM_TOKEN:
|
||||
from_secret: bot_token
|
||||
POSTGRES_URL_CONNECT:
|
||||
from_secret: postgres_url_connect
|
||||
settings:
|
||||
envs: [ TELEGRAM_TOKEN,POSTGRES_URL_CONNECT ]
|
||||
commands:
|
||||
- CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o smm_tg cmd/smm_tg/main.go
|
||||
- touch .env
|
||||
- echo TELEGRAM_TOKEN=$${TELEGRAM_TOKEN} >> .env
|
||||
- echo POSTGRES_URL_CONNECT=$${POSTGRES_URL_CONNECT} >> .env
|
||||
|
||||
- name: test
|
||||
pull: if-not-exists
|
||||
image: golang:1.23
|
||||
commands:
|
||||
- go test ./...
|
||||
|
||||
- name: copy to server
|
||||
pull: if-not-exists
|
||||
image: appleboy/drone-scp
|
||||
settings:
|
||||
host:
|
||||
from_secret: ssh_ip
|
||||
username:
|
||||
from_secret: ssh_user
|
||||
key:
|
||||
from_secret: ssh_key
|
||||
port:
|
||||
from_secret: ssh_port
|
||||
target: /home/crab/deploys/butler_bot
|
||||
source:
|
||||
- .env
|
||||
- build/ci/Dockerfile
|
||||
- deploy/docker-compose.yml
|
||||
- migrations
|
||||
- smm_tg
|
||||
rm: true
|
||||
|
||||
- name: deploy
|
||||
pull: if-not-exists
|
||||
image: appleboy/drone-ssh
|
||||
environment:
|
||||
DB_PASS:
|
||||
from_secret: db_pass
|
||||
settings:
|
||||
host:
|
||||
from_secret: ssh_ip
|
||||
username:
|
||||
from_secret: ssh_user
|
||||
key:
|
||||
from_secret: ssh_key
|
||||
port:
|
||||
from_secret: ssh_port
|
||||
envs: [ DB_PASS ]
|
||||
script:
|
||||
- cd /home/crab/deploys/smm_tg
|
||||
- cp /etc/ssl/certs/ca-certificates.crt .
|
||||
- mv build/ci/Dockerfile .
|
||||
- mv deploy/docker-compose.yml .
|
||||
- rm -r build deploy
|
||||
- export PATH=$PATH:/usr/local/go/bin:/$HOME/go/bin
|
||||
- goose -allow-missing -dir ./migrations postgres "user=crab password=$${DB_PASS} dbname=smm_tg host=localhost port=5432 sslmode=disable" up
|
||||
- docker-compose up -d --force-recreate
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- master
|
||||
event:
|
||||
- push
|
||||
@@ -0,0 +1,4 @@
|
||||
FROM golang:1.23.3-alpine3.19
|
||||
COPY smm_tg /usr/local/bin/smm_tg
|
||||
RUN chmod +x /usr/local/bin/smm_tg
|
||||
CMD ["smm_tg"]
|
||||
@@ -0,0 +1,15 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
smm_tg:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- "8185:8090"
|
||||
networks:
|
||||
- common-network
|
||||
|
||||
networks:
|
||||
common-network:
|
||||
external: true
|
||||
Reference in New Issue
Block a user