Docker deploy with private registry
This commit is contained in:
parent
02bab99d4e
commit
b6c1fd2e8e
|
@ -32,25 +32,41 @@ try {
|
|||
}
|
||||
}
|
||||
stage ('Deploy') {
|
||||
withCredentials([dockerCert(credentialsId: 'docker', variable: 'DOCKER_CERT_PATH')]) {
|
||||
switch (env.BRANCH_NAME) {
|
||||
case 'master':
|
||||
env.PORT = 5000
|
||||
break;
|
||||
case 'test':
|
||||
env.PORT = 5001
|
||||
break;
|
||||
}
|
||||
env.COMPOSE_PROJECT_NAME = env.JOB_NAME.replace('/', '-');
|
||||
env.TAG = env.BRANCH_NAME
|
||||
|
||||
env.COMPOSE_PROJECT_NAME = env.JOB_NAME.replace('/', '-');
|
||||
switch (env.BRANCH_NAME) {
|
||||
case 'master':
|
||||
env.PORT = 5002
|
||||
break;
|
||||
case 'test':
|
||||
env.PORT = 5001
|
||||
break;
|
||||
}
|
||||
|
||||
withCredentials([usernamePassword(
|
||||
credentialsId: 'docker-registry',
|
||||
usernameVariable: 'USER',
|
||||
passwordVariable: 'PASSWORD')
|
||||
]) {
|
||||
env.REGISTRY = 'registry.verdnatura.es'
|
||||
sh "docker login --username \"${env.USER}\" --password \"${env.PASSWORD}\" ${env.REGISTRY}"
|
||||
sh "docker-compose build --parallel"
|
||||
sh "docker-compose push"
|
||||
sh "docker logout ${env.REGISTRY}"
|
||||
}
|
||||
|
||||
withCredentials([dockerCert(
|
||||
credentialsId: 'docker',
|
||||
variable: 'DOCKER_CERT_PATH')
|
||||
]) {
|
||||
env.DOCKER_TLS_VERIFY = 1
|
||||
env.TAG = env.BRANCH_NAME
|
||||
|
||||
env.DOCKER_HOST = 'tcp://vch1.verdnatura.es:2376';
|
||||
sh "docker-compose up --build -d"
|
||||
sh "docker-compose up -d"
|
||||
|
||||
env.DOCKER_HOST = 'tcp://vch2.verdnatura.es:2376';
|
||||
sh "docker-compose up --build -d"
|
||||
sh "docker-compose up -d"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
version: '3.5'
|
||||
services:
|
||||
app:
|
||||
image: registry.verdnatura.es/salix-app:${TAG}
|
||||
restart: unless-stopped
|
||||
build:
|
||||
context: .
|
||||
dockerfile: services/nginx/Dockerfile
|
||||
ports:
|
||||
- ${PORT}:80
|
||||
image: salix-app:${TAG}
|
||||
restart: unless-stopped
|
||||
links:
|
||||
- api
|
||||
api:
|
||||
image: registry.verdnatura.es/salix-api:${TAG}
|
||||
restart: unless-stopped
|
||||
build: .
|
||||
environment:
|
||||
- NODE_ENV
|
||||
restart: unless-stopped
|
||||
image: salix-api:${TAG}
|
||||
volumes:
|
||||
- /containers/salix:/etc/salix
|
||||
|
|
Loading…
Reference in New Issue