Files
link-shortener/.drone.yml
Giovanni Rezcjikov 25d444f84e
All checks were successful
continuous-integration/drone/push Build is passing
.drone.yml fix
2026-02-21 21:22:17 +03:00

60 lines
1.3 KiB
YAML

kind: pipeline
type: docker
name: default
steps:
- name: go test
image: golang:1.25-alpine3.21
commands:
- apk add --no-cache git curl
- go mod tidy
- go test ./...
- name: build and push docker image
image: docker:24
volumes:
- name: dockersock
path: /var/run/docker.sock
commands:
- docker build -t localhost:5000/link-shortener:latest -f dockerfile .
- docker push localhost:5000/link-shortener:latest
- name: deploy with compose
image: docker:24
volumes:
- name: dockersock
path: /var/run/docker.sock
- name: appdir
path: /opt/app
environment:
IMAGE: localhost:5000/link-shortener:latest
SERVER_HOST: link.dusiburg.ru
VIRTUAL_HOST: link.dusiburg.ru
VIRTUAL_PORT: 8080
LETSENCRYPT_HOST: link.dusiburg.ru
LETSENCRYPT_EMAIL:
from_secret: LETSENCRYPT_EMAIL
SERVER_PORT: 8080
REDIS_PASSWORD:
from_secret: REDIS_PASSWORD
REDIS_URL:
from_secret: REDIS_URL
commands:
- apk add --no-cache docker-cli-compose
- cp -r . /opt/app
- cd /opt/app
- docker compose pull
- docker compose up -d
volumes:
- name: dockersock
host:
path: /var/run/docker.sock
- name: appdir
host:
path: /opt/drone/link-shortener
trigger:
branch:
- main