From 0bea4180a1d65d03a289cb6eb716e187a5efaafd Mon Sep 17 00:00:00 2001 From: user-penguin Date: Sun, 19 May 2024 17:02:50 +0700 Subject: [PATCH] deploy --- .drone.yml | 53 ++++++++++++++++++++++++++++++++++++++++++++++ Dockerfile | 5 +++++ docker-compose.yml | 12 +++++++++++ 3 files changed, 70 insertions(+) create mode 100644 .drone.yml create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..cfc1b3d --- /dev/null +++ b/.drone.yml @@ -0,0 +1,53 @@ +kind: pipeline +type: docker +name: default + +steps: + - name: build + image: golang + commands: + - go build -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 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..fbd2a5b --- /dev/null +++ b/Dockerfile @@ -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 ["cake_crm"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..9b23da0 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,12 @@ +version: '3.8' + +services: + cake_crm: + build: + context: . + dockerfile: Dockerfile + ports: + - "8080:8080" +# environment: +# - ENV_VAR_NAME=env_var_value +