added drone
This commit is contained in:
1 parent
fe7fe0f7cc
commit
b7cb8e026e
10 files changed
+113
No files matched your search
+113
@@ -0,0 +1,113 @@
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: build-and-deploy
|
||||
|
||||
steps:
|
||||
# Budowanie obrazu frontendu dla release
|
||||
- name: build-web-release
|
||||
image: docker:latest
|
||||
environment:
|
||||
DOCKER_DRIVER: overlay2
|
||||
OUTBO_BACKEND_URL: https://prodatapi.outbo.pl
|
||||
services:
|
||||
- name: docker
|
||||
image: docker:dind
|
||||
when:
|
||||
ref:
|
||||
include:
|
||||
- /^refs/tags\/release\/.*$/
|
||||
commands:
|
||||
- docker login -u gitea-ci -p ${DRONE_GIT_PASSWORD} ${DRONE_REGISTRY}
|
||||
- docker pull ${DRONE_REGISTRY}/web:${DRONE_COMMIT_BEFORE} || true
|
||||
- docker build -f web.Dockerfile --build-arg outbo_env=staging --build-arg backend_url=https://prodatapi.outbo.pl --cache-from ${DRONE_REGISTRY}/web:${DRONE_COMMIT_BEFORE} --cache-from ${DRONE_REGISTRY}/web:latest -t ${DRONE_REGISTRY}/web:latest -t ${DRONE_REGISTRY}/web:${DRONE_COMMIT_SHA} ./evg-outbo-web
|
||||
- docker push ${DRONE_REGISTRY}/web:latest
|
||||
- docker push ${DRONE_REGISTRY}/web:${DRONE_COMMIT_SHA}
|
||||
|
||||
# Budowanie obrazu frontendu dla master
|
||||
- name: build-web-master
|
||||
image: docker:latest
|
||||
environment:
|
||||
DOCKER_DRIVER: overlay2
|
||||
services:
|
||||
- name: docker
|
||||
image: docker:dind
|
||||
when:
|
||||
ref:
|
||||
include:
|
||||
- refs/heads/master
|
||||
commands:
|
||||
- docker login -u gitea-ci -p ${DRONE_GIT_PASSWORD} ${DRONE_REGISTRY}
|
||||
- docker pull ${DRONE_REGISTRY}/web:${DRONE_COMMIT_BEFORE} || true
|
||||
- docker build -f web.Dockerfile --build-arg outbo_env=production --build-arg backend_url=https://prodatapi.outbo.pl --cache-from ${DRONE_REGISTRY}/web:${DRONE_COMMIT_BEFORE} --cache-from ${DRONE_REGISTRY}/web:latest -t ${DRONE_REGISTRY}/web:latest -t ${DRONE_REGISTRY}/web:${DRONE_COMMIT_SHA} ./evg-outbo-web
|
||||
- docker push ${DRONE_REGISTRY}/web:latest
|
||||
- docker push ${DRONE_REGISTRY}/web:${DRONE_COMMIT_SHA}
|
||||
|
||||
# Budowanie obrazu backendu
|
||||
- name: build-api
|
||||
image: docker:latest
|
||||
environment:
|
||||
DOCKER_DRIVER: overlay2
|
||||
services:
|
||||
- name: docker
|
||||
image: docker:dind
|
||||
when:
|
||||
ref:
|
||||
include:
|
||||
- refs/heads/master
|
||||
- /^refs/tags\/release\/.*$/
|
||||
commands:
|
||||
- docker login -u gitea-ci -p ${DRONE_GIT_PASSWORD} ${DRONE_REGISTRY}
|
||||
- docker pull ${DRONE_REGISTRY}/api:${DRONE_COMMIT_BEFORE} || true
|
||||
- docker build -f api.Dockerfile --cache-from ${DRONE_REGISTRY}/api:${DRONE_COMMIT_BEFORE} --cache-from ${DRONE_REGISTRY}/api:latest -t ${DRONE_REGISTRY}/api:latest -t ${DRONE_REGISTRY}/api:${DRONE_COMMIT_SHA} ./evg-outbo-api
|
||||
- docker push ${DRONE_REGISTRY}/api:latest
|
||||
- docker push ${DRONE_REGISTRY}/api:${DRONE_COMMIT_SHA}
|
||||
|
||||
# Wdrożenie na środowisko staging
|
||||
# - name: deploy-staging
|
||||
# image: kroniak/ssh-client
|
||||
# environment:
|
||||
# STAGE_HOST: staging.prodat.pl
|
||||
# STAGE_USER: deploy
|
||||
# STAGE_KEY:
|
||||
# from_secret: stage_ssh_key
|
||||
# DRONE_REGISTRY: your-docker-registry
|
||||
# commands:
|
||||
# - mkdir -p ~/.ssh
|
||||
# - chmod 700 ~/.ssh
|
||||
# - echo "${STAGE_KEY}" > ~/.ssh/id_rsa
|
||||
# - chmod 600 ~/.ssh/id_rsa
|
||||
# - scp -r ./docker-compose.staging.yml ${STAGE_USER}@${STAGE_HOST}:~/docker-compose.yml
|
||||
# - >
|
||||
# ssh ${STAGE_USER}@${STAGE_HOST} << EOF
|
||||
# docker login -u gitea-ci -p your-password ${DRONE_REGISTRY}
|
||||
# docker pull ${DRONE_REGISTRY}/web:${DRONE_COMMIT_SHA}
|
||||
# docker pull ${DRONE_REGISTRY}/api:${DRONE_COMMIT_SHA}
|
||||
# docker-compose rm --force backend
|
||||
# docker-compose rm --force frontend
|
||||
# docker-compose up -d backend frontend
|
||||
# EOF
|
||||
|
||||
# Wdrożenie na środowisko produkcyjne
|
||||
- name: deploy-production
|
||||
image: kroniak/ssh-client
|
||||
environment:
|
||||
PROD_HOST: prodat.outbo.pl
|
||||
PROD_USER: deploy
|
||||
PROD_KEY:
|
||||
from_secret: prod_ssh_key
|
||||
DRONE_REGISTRY: your-docker-registry
|
||||
commands:
|
||||
- mkdir -p ~/.ssh
|
||||
- chmod 700 ~/.ssh
|
||||
- echo "${PROD_KEY}" > ~/.ssh/id_rsa
|
||||
- chmod 600 ~/.ssh/id_rsa
|
||||
- scp -r ./docker-compose.prod.yml ${PROD_USER}@${PROD_HOST}:~/docker-compose.yml
|
||||
- >
|
||||
ssh ${PROD_USER}@${PROD_HOST} << EOF
|
||||
docker login -u gitea-ci -p your-password ${DRONE_REGISTRY}
|
||||
docker pull ${DRONE_REGISTRY}/web:${DRONE_COMMIT_SHA}
|
||||
docker pull ${DRONE_REGISTRY}/api:${DRONE_COMMIT_SHA}
|
||||
docker-compose rm --force backend
|
||||
docker-compose rm --force frontend
|
||||
docker-compose up -d backend frontend
|
||||
EOF
|
||||
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Reference in new issue
Block a user