From 21b454892db292c00341e91c7bd57a266ef972e3 Mon Sep 17 00:00:00 2001 From: Chris Lima Date: Tue, 5 Nov 2024 14:58:01 -0300 Subject: [PATCH] Jenkinsfile --- Jenkinsfile | 3 ++- docker-compose-jenkins.yaml | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 83b375b..20ec27d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -58,9 +58,10 @@ pipeline { steps { script { // Comando para inserir um documento JSON no MongoDB + sh """ mongo ${MONGO_HOST}:${MONGO_PORT}/${MONGO_DATABASE} --eval ' - db.${MONGO_COLLECTION}.insert({ name: "Jenkins", description: "Inserted from Jenkins Pipeline" }); + db.${MONGO_COLLECTION}.insert({ name: "Jenkins", description: "Inserindo do pipeline" }); ' """ } diff --git a/docker-compose-jenkins.yaml b/docker-compose-jenkins.yaml index 4103a2b..efb6367 100644 --- a/docker-compose-jenkins.yaml +++ b/docker-compose-jenkins.yaml @@ -11,6 +11,8 @@ - 50000:50000 volumes: - ./jenkins_compose/jenkins_configuration:/var/jenkins_home + networks: + - my_network mongodb: image: mongo @@ -21,6 +23,8 @@ MONGO_INITDB_ROOT_PASSWORD: root volumes: - /Users/user/Documents/mongodb:/data/db + networks: + - my_network mongo-express: image: mongo-express @@ -31,6 +35,13 @@ ME_CONFIG_MONGODB_ADMINUSERNAME: root ME_CONFIG_MONGODB_ADMINPASSWORD: root ME_CONFIG_MONGODB_SERVER: mongodb + networks: + - my_network + + + networks: + my_network: + driver: bridge # O código abaixo é usado para subir um outro container a partir de um dockerfile. # Mude o nome e porta para refletir seu ambiente.