2022-03-08 14:19:19 +00:00
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: linux-amd64
|
|
|
|
|
|
|
|
platform:
|
|
|
|
arch: amd64
|
|
|
|
os: linux
|
|
|
|
|
|
|
|
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:42:26 +00:00
|
|
|
settings:
|
|
|
|
host:
|
|
|
|
from_secret: docker_host
|
|
|
|
username:
|
|
|
|
from_secret: docker_username
|
|
|
|
password:
|
|
|
|
from_secret: docker_password
|
|
|
|
port:
|
|
|
|
from_secret: docker_port
|
2022-03-08 15:06:54 +00:00
|
|
|
environment:
|
|
|
|
REPO:
|
|
|
|
from_secret: repo
|
|
|
|
IP:
|
|
|
|
from_secret: deploy_ip
|
|
|
|
NET:
|
|
|
|
from_secret: deploy_net
|
|
|
|
NAME:
|
2022-03-08 18:35:36 +00:00
|
|
|
from_secret: deploy_name
|
|
|
|
script:
|
2022-03-08 15:06:54 +00:00
|
|
|
# Deploy image as container
|
|
|
|
- docker run -d --net $NET --ip $IP --hostname $NAME --restart unless-stopped $REPO
|