This commit is contained in:
123
.drone.yml
123
.drone.yml
@@ -39,7 +39,7 @@ steps:
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: build-and-publish
|
||||
name: build-backend
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
@@ -54,7 +54,94 @@ depends_on:
|
||||
- code-quality
|
||||
|
||||
steps:
|
||||
- name: build-and-push
|
||||
- name: build-backend-image
|
||||
image: plugins/docker
|
||||
settings:
|
||||
registry: registry.nevetime.ru
|
||||
repo: registry.nevetime.ru/mc-panel-backend
|
||||
tags:
|
||||
- latest
|
||||
- ${DRONE_COMMIT_SHA:0:8}
|
||||
- ${DRONE_BRANCH}
|
||||
auto_tag: true
|
||||
dockerfile: backend/Dockerfile
|
||||
context: backend
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
from_secret: docker_password
|
||||
build_args:
|
||||
- BUILD_DATE=${DRONE_BUILD_CREATED}
|
||||
- VCS_REF=${DRONE_COMMIT_SHA}
|
||||
- VERSION=${DRONE_TAG:-${DRONE_BRANCH}}
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
- tag
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: build-frontend
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- main
|
||||
- master
|
||||
- develop
|
||||
event:
|
||||
- push
|
||||
- tag
|
||||
|
||||
depends_on:
|
||||
- code-quality
|
||||
|
||||
steps:
|
||||
- name: build-frontend-image
|
||||
image: plugins/docker
|
||||
settings:
|
||||
registry: registry.nevetime.ru
|
||||
repo: registry.nevetime.ru/mc-panel-frontend
|
||||
tags:
|
||||
- latest
|
||||
- ${DRONE_COMMIT_SHA:0:8}
|
||||
- ${DRONE_BRANCH}
|
||||
auto_tag: true
|
||||
dockerfile: frontend/Dockerfile
|
||||
context: frontend
|
||||
target: production
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
from_secret: docker_password
|
||||
build_args:
|
||||
- BUILD_DATE=${DRONE_BUILD_CREATED}
|
||||
- VCS_REF=${DRONE_COMMIT_SHA}
|
||||
- VERSION=${DRONE_TAG:-${DRONE_BRANCH}}
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
- tag
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: build-monolith
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- main
|
||||
- master
|
||||
- develop
|
||||
event:
|
||||
- push
|
||||
- tag
|
||||
|
||||
depends_on:
|
||||
- code-quality
|
||||
|
||||
steps:
|
||||
- name: build-monolith-image
|
||||
image: plugins/docker
|
||||
settings:
|
||||
registry: registry.nevetime.ru
|
||||
@@ -79,18 +166,6 @@ steps:
|
||||
- push
|
||||
- tag
|
||||
|
||||
- name: verify-image
|
||||
image: alpine:latest
|
||||
commands:
|
||||
- echo "Image built successfully registry.nevetime.ru/mc-panel:${DRONE_COMMIT_SHA:0:8}"
|
||||
- echo "Security scanning can be done manually with trivy"
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
- tag
|
||||
depends_on:
|
||||
- build-and-push
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
@@ -103,10 +178,12 @@ trigger:
|
||||
- push
|
||||
|
||||
depends_on:
|
||||
- build-and-publish
|
||||
- build-backend
|
||||
- build-frontend
|
||||
- build-monolith
|
||||
|
||||
steps:
|
||||
- name: deploy-to-staging
|
||||
- name: deploy-separate-services
|
||||
image: alpine:latest
|
||||
environment:
|
||||
STAGING_HOST:
|
||||
@@ -117,10 +194,10 @@ steps:
|
||||
from_secret: staging_ssh_key
|
||||
commands:
|
||||
- apk add --no-cache openssh-client
|
||||
- echo "Deploying to staging..."
|
||||
- echo "Deploying separate services to staging..."
|
||||
- echo "$STAGING_KEY" | base64 -d > /tmp/ssh_key
|
||||
- chmod 600 /tmp/ssh_key
|
||||
- ssh -o StrictHostKeyChecking=no -i /tmp/ssh_key $STAGING_USER@$STAGING_HOST "docker pull registry.nevetime.ru/mc-panel:${DRONE_COMMIT_SHA:0:8}"
|
||||
- ssh -o StrictHostKeyChecking=no -i /tmp/ssh_key $STAGING_USER@$STAGING_HOST "docker pull registry.nevetime.ru/mc-panel-backend:${DRONE_COMMIT_SHA:0:8} && docker pull registry.nevetime.ru/mc-panel-frontend:${DRONE_COMMIT_SHA:0:8}"
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
@@ -134,10 +211,12 @@ trigger:
|
||||
- tag
|
||||
|
||||
depends_on:
|
||||
- build-and-publish
|
||||
- build-backend
|
||||
- build-frontend
|
||||
- build-monolith
|
||||
|
||||
steps:
|
||||
- name: deploy-to-production
|
||||
- name: deploy-separate-services
|
||||
image: alpine:latest
|
||||
environment:
|
||||
PROD_HOST:
|
||||
@@ -148,7 +227,7 @@ steps:
|
||||
from_secret: production_ssh_key
|
||||
commands:
|
||||
- apk add --no-cache openssh-client
|
||||
- echo "Deploying to production..."
|
||||
- echo "Deploying separate services to production..."
|
||||
- echo "$PROD_KEY" | base64 -d > /tmp/ssh_key
|
||||
- chmod 600 /tmp/ssh_key
|
||||
- ssh -o StrictHostKeyChecking=no -i /tmp/ssh_key $PROD_USER@$PROD_HOST "docker pull registry.nevetime.ru/mc-panel:${DRONE_TAG}"
|
||||
- ssh -o StrictHostKeyChecking=no -i /tmp/ssh_key $PROD_USER@$PROD_HOST "docker pull registry.nevetime.ru/mc-panel-backend:${DRONE_TAG} && docker pull registry.nevetime.ru/mc-panel-frontend:${DRONE_TAG}"
|
||||
Reference in New Issue
Block a user