2022-03-08 14:19:19 +00:00
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: linux-amd64
|
|
|
|
|
|
|
|
platform:
|
|
|
|
arch: amd64
|
|
|
|
os: linux
|
2022-03-08 18:54:06 +00:00
|
|
|
|
2022-03-08 14:19:19 +00:00
|
|
|
steps:
|
|
|
|
- name: generate_tag
|
|
|
|
image: golang
|
|
|
|
commands:
|
|
|
|
- echo -n "${DRONE_BRANCH//\//-}-${DRONE_COMMIT_SHA:0:8}, latest" > .tags
|
|
|
|
|
|
|
|
|
|
|
|
- name: publish
|
|
|
|
image: plugins/docker
|
|
|
|
settings:
|
|
|
|
username:
|
|
|
|
from_secret: username
|
|
|
|
password:
|
|
|
|
from_secret: password
|
|
|
|
registry:
|
|
|
|
from_secret: registry
|
|
|
|
repo:
|
|
|
|
from_secret: repo
|
2022-03-08 15:06:54 +00:00
|
|
|
dockerfile: Dockerfile
|
|
|
|
|
|
|
|
- name: deploy
|
2022-03-08 18:35:36 +00:00
|
|
|
image: appleboy/drone-ssh
|
2022-03-08 18:54:06 +00:00
|
|
|
network_mode: host
|
2022-03-08 15:06:54 +00:00
|
|
|
environment:
|
2022-03-10 07:18:48 +00:00
|
|
|
# REPO:
|
|
|
|
# from_secret: repo
|
|
|
|
# IP:
|
|
|
|
# from_secret: deploy_ip
|
|
|
|
# NET:
|
|
|
|
# from_secret: deploy_net
|
|
|
|
# NAME:
|
|
|
|
# from_secret: deploy_name
|
2022-03-09 08:39:15 +00:00
|
|
|
PLUGIN_HOST:
|
2022-03-10 07:18:48 +00:00
|
|
|
from_secret: ssh_host
|
2022-03-09 08:39:15 +00:00
|
|
|
PLUGIN_USERNAME:
|
2022-03-10 07:18:48 +00:00
|
|
|
from_secret: ssh_user
|
2022-03-09 08:39:15 +00:00
|
|
|
PLUGIN_PASSWORD:
|
2022-03-10 07:18:48 +00:00
|
|
|
from_secret: ssh_password
|
2022-03-09 08:40:38 +00:00
|
|
|
PLUGIN_SCRIPT: whoami
|
2022-03-10 07:18:48 +00:00
|
|
|
# script:
|
2022-03-08 15:06:54 +00:00
|
|
|
# Deploy image as container
|
2022-03-09 08:40:38 +00:00
|
|
|
# - docker run -d --net $NET --ip $IP --hostname $NAME --restart unless-stopped $REPO
|