From e50e25e939a45de156b80f1affd31c9d7f44e129 Mon Sep 17 00:00:00 2001 From: Oluwafemi Solagbade Date: Thu, 23 Mar 2023 13:51:54 +0100 Subject: [PATCH 01/16] changed working directory to html from www --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index aba30a1..0323917 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM php:7-apache -MAINTAINER Dare dare@darey.io +# MAINTAINER Dare dare@darey.io ENV MYSQL_IP=$MYSQL_IP ENV MYSQL_USER=$MYSQL_USER @@ -14,7 +14,7 @@ COPY start-apache /usr/local/bin RUN a2enmod rewrite # Copy application source -COPY html /var/www -RUN chown -R www-data:www-data /var/www +COPY html /var/www/html +RUN chown -R www-data:www-data /var/www/html CMD ["start-apache"] From 3d1f6c583a2d13b4a9fd3b12cf38933ef31a5504 Mon Sep 17 00:00:00 2001 From: Oluwafemi Solagbade Date: Thu, 23 Mar 2023 19:31:09 +0100 Subject: [PATCH 02/16] db connection updates --- Dockerfile | 4 ++-- html/.env | 2 +- html/db_conn.php | 11 ++++++----- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0323917..90bc5c4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ COPY start-apache /usr/local/bin RUN a2enmod rewrite # Copy application source -COPY html /var/www/html -RUN chown -R www-data:www-data /var/www/html +COPY html /var/www +RUN chown -R www-data:www-data /var/www CMD ["start-apache"] diff --git a/html/.env b/html/.env index 8c4f143..e03d84b 100644 --- a/html/.env +++ b/html/.env @@ -2,5 +2,5 @@ MYSQL_IP=mysqlserverhost MYSQL_USER=Admin -MYSQL_PASS=Admin.com +MYSQL_PASS=Password MYSQL_DBNAME=toolingdb \ No newline at end of file diff --git a/html/db_conn.php b/html/db_conn.php index c5e4626..1028998 100644 --- a/html/db_conn.php +++ b/html/db_conn.php @@ -9,16 +9,17 @@ // enabling environment variable for php - -$servername = $_ENV["MYSQL_IP"]; // input servername -$username = $_ENV["MYSQL_USER"]; // input username -$password = $_ENV["MYSQL_PASS"]; //input password -$dbname = $_ENV["MYSQL_DBNAME"]; // input dbname +$servername = "mysqlserverhost"; // input servername +$username = ""; // input username +$password = ""; //input password +$dbname = "toolingdb"; // input dbname // Create connection + $conn = new mysqli($servername, $username, $password, $dbname); + // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); From 132665f10c754c470d9df8c8c33bf4817021d0c2 Mon Sep 17 00:00:00 2001 From: Oluwafemi Solagbade Date: Fri, 24 Mar 2023 12:04:26 +0100 Subject: [PATCH 03/16] update environmental variables in .env and db:conn --- html/.env | 4 ++-- html/db_conn.php | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/html/.env b/html/.env index e03d84b..5d54ccf 100644 --- a/html/.env +++ b/html/.env @@ -1,6 +1,6 @@ # input your environment variables MYSQL_IP=mysqlserverhost -MYSQL_USER=Admin -MYSQL_PASS=Password +MYSQL_USER= +MYSQL_PASS= MYSQL_DBNAME=toolingdb \ No newline at end of file diff --git a/html/db_conn.php b/html/db_conn.php index 1028998..3b24209 100644 --- a/html/db_conn.php +++ b/html/db_conn.php @@ -9,10 +9,10 @@ // enabling environment variable for php -$servername = "mysqlserverhost"; // input servername -$username = ""; // input username -$password = ""; //input password -$dbname = "toolingdb"; // input dbname +$servername = $_ENV["MYSQL_IP"]; // input servername +$username = $_ENV["MYSQL_USER"]; // input username +$password = $_ENV["MYSQL_PASS"]; //input password +$dbname = $_ENV["MYSQL_DBNAME"]; // input dbname // Create connection From 6f6688942b6864c1928c13b8432ed8fcc42df7a7 Mon Sep 17 00:00:00 2001 From: Oluwafemi Solagbade Date: Tue, 28 Mar 2023 17:57:48 +0100 Subject: [PATCH 04/16] jenkinsfile update --- Jenkinsfile | 74 +++++++++++--------------------------------------- Jenkinsfile.bk | 73 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+), 58 deletions(-) create mode 100644 Jenkinsfile.bk diff --git a/Jenkinsfile b/Jenkinsfile index e17ef79..bde6c52 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,73 +1,31 @@ pipeline { - agent { - kubernetes { - yaml ''' - apiVersion: v1 - kind: Pod - spec: - containers: - - name: maven - image: maven:alpine - command: - - cat - tty: true - - name: docker - image: docker:latest - command: - - cat - tty: true - volumeMounts: - - mountPath: /var/run/docker.sock - name: docker-sock - volumes: - - name: docker-sock - hostPath: - path: /var/run/docker.sock - ''' - } + agent any + options { + buildDiscarder(logRotator(numToKeepStr: '5')) + } + environment { + DOCKERHUB_CREDENTIALS = credentials('dockerhub') } stages { - stage('Clone') { - steps { - container('maven') { - git branch: 'main', changelog: false, poll: false, url: 'https://mohdsabir-cloudside@bitbucket.org/mohdsabir-cloudside/java-app.git' - } - } - } - stage('Build-Jar-file') { + stage('Build image for toolng-app') { steps { - container('maven') { - sh 'mvn package' - } + sh 'docker build -t stlng/tooling-master:0.0.1 .' } } - stage('Build-Docker-Image') { + stage('Login to docker hub') { steps { - container('docker') { - sh 'docker build -t dareyregistry/java-app:latest .' - } + sh 'echo $DOCKERHUB_CREDENTIALS_PSW | docker login -u $DOCKERHUB_CREDENTIALS_USR --password-stdin' } } - stage('Login-Into-Docker') { + stage('Push docker image to docker hub registry') { steps { - container('docker') { - sh 'docker login -u dareyregistry -p Phartion001ng' + sh 'docker push stlng/tooling-master:0.0.1' } } - } - stage('Push-Images-Docker-to-DockerHub') { - steps { - container('docker') { - sh 'docker push dareyregistry/java-app:latest' - } - } - } } - post { - always { - container('docker') { - sh 'docker logout' - } - } + post { + always { + sh 'docker logout' } + } } \ No newline at end of file diff --git a/Jenkinsfile.bk b/Jenkinsfile.bk new file mode 100644 index 0000000..e17ef79 --- /dev/null +++ b/Jenkinsfile.bk @@ -0,0 +1,73 @@ +pipeline { + agent { + kubernetes { + yaml ''' + apiVersion: v1 + kind: Pod + spec: + containers: + - name: maven + image: maven:alpine + command: + - cat + tty: true + - name: docker + image: docker:latest + command: + - cat + tty: true + volumeMounts: + - mountPath: /var/run/docker.sock + name: docker-sock + volumes: + - name: docker-sock + hostPath: + path: /var/run/docker.sock + ''' + } + } + stages { + stage('Clone') { + steps { + container('maven') { + git branch: 'main', changelog: false, poll: false, url: 'https://mohdsabir-cloudside@bitbucket.org/mohdsabir-cloudside/java-app.git' + } + } + } + stage('Build-Jar-file') { + steps { + container('maven') { + sh 'mvn package' + } + } + } + stage('Build-Docker-Image') { + steps { + container('docker') { + sh 'docker build -t dareyregistry/java-app:latest .' + } + } + } + stage('Login-Into-Docker') { + steps { + container('docker') { + sh 'docker login -u dareyregistry -p Phartion001ng' + } + } + } + stage('Push-Images-Docker-to-DockerHub') { + steps { + container('docker') { + sh 'docker push dareyregistry/java-app:latest' + } + } + } + } + post { + always { + container('docker') { + sh 'docker logout' + } + } + } +} \ No newline at end of file From a2b4605491785f1a64d49034813cd185a6829b68 Mon Sep 17 00:00:00 2001 From: Oluwafemi Solagbade Date: Tue, 28 Mar 2023 18:00:03 +0100 Subject: [PATCH 05/16] replaced feature in docker image name --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index bde6c52..b9e5459 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,7 +9,7 @@ pipeline { stages { stage('Build image for toolng-app') { steps { - sh 'docker build -t stlng/tooling-master:0.0.1 .' + sh 'docker build -t stlng/tooling-feature:0.0.1 .' } } stage('Login to docker hub') { @@ -19,7 +19,7 @@ pipeline { } stage('Push docker image to docker hub registry') { steps { - sh 'docker push stlng/tooling-master:0.0.1' + sh 'docker push stlng/tooling-feature:0.0.1' } } } From 6eaa13e6baf1c070905ed2cddfc5a59ea87b6150 Mon Sep 17 00:00:00 2001 From: Oluwafemi Solagbade Date: Wed, 29 Mar 2023 11:17:51 +0100 Subject: [PATCH 06/16] removed test.txt --- test.txt | 1 - 1 file changed, 1 deletion(-) delete mode 100644 test.txt diff --git a/test.txt b/test.txt deleted file mode 100644 index 9a74024..0000000 --- a/test.txt +++ /dev/null @@ -1 +0,0 @@ -Testing git connectivity From 18e2da646a6be78681537d5d656157cf893323bd Mon Sep 17 00:00:00 2001 From: Oluwafemi Solagbade Date: Wed, 29 Mar 2023 11:18:53 +0100 Subject: [PATCH 07/16] removed test.txt --- test.txt | 1 - 1 file changed, 1 deletion(-) delete mode 100644 test.txt diff --git a/test.txt b/test.txt deleted file mode 100644 index 9a74024..0000000 --- a/test.txt +++ /dev/null @@ -1 +0,0 @@ -Testing git connectivity From c69786623687e5c788f269248592433ce2dc03cc Mon Sep 17 00:00:00 2001 From: Femi Solagbade Date: Thu, 30 Mar 2023 10:24:53 +0100 Subject: [PATCH 08/16] added path variable --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index bde6c52..854cda1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,6 +4,7 @@ pipeline { buildDiscarder(logRotator(numToKeepStr: '5')) } environment { + PATH = '/usr/bin/sh' DOCKERHUB_CREDENTIALS = credentials('dockerhub') } stages { From 62b944a22ee19cf03e52306909aabd4ab84f921a Mon Sep 17 00:00:00 2001 From: Femi Solagbade Date: Sat, 15 Apr 2023 14:02:54 +0100 Subject: [PATCH 09/16] add tooling.yml file for docker-compose --- tooling.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tooling.yml diff --git a/tooling.yml b/tooling.yml new file mode 100644 index 0000000..00e470b --- /dev/null +++ b/tooling.yml @@ -0,0 +1,23 @@ +version: "3.9" +services: + tooling_frontend: + build: . + ports: + - "5000:80" + volumes: + - tooling_frontend:/var/www/html + links: + - db + db: + image: mysql:5.7 + restart: always + environment: + MYSQL_DATABASE: "toolingdb" + MYSQL_USER: "" + MYSQL_PASSWORD: "" + MYSQL_RANDOM_ROOT_PASSWORD: "1" + volumes: + - db:/var/lib/mysql +volumes: + tooling_frontend: + db: \ No newline at end of file From b2bc25741ba3e11ed18278ee3b6e36333b11c49f Mon Sep 17 00:00:00 2001 From: Femi Solagbade Date: Thu, 20 Apr 2023 17:13:33 +0100 Subject: [PATCH 10/16] jenkins-pipeline-docker-compose update --- .gitignore | 1 + Jenkinsfile | 36 +++++++++++++++++++++++++++++++----- Jenkinsfile.bak | 32 ++++++++++++++++++++++++++++++++ create_user.sql | 1 + docker | 10 ++++++++++ html/.env | 2 +- tooling.bak | 39 +++++++++++++++++++++++++++++++++++++++ tooling.yml | 23 +++++++++++++++++++++++ 8 files changed, 138 insertions(+), 6 deletions(-) create mode 100644 .gitignore create mode 100644 Jenkinsfile.bak create mode 100644 create_user.sql create mode 100644 docker create mode 100644 tooling.bak create mode 100644 tooling.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4c49bd7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.env diff --git a/Jenkinsfile b/Jenkinsfile index b9e5459..2ba639c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,28 +4,54 @@ pipeline { buildDiscarder(logRotator(numToKeepStr: '5')) } environment { + PATH = '/usr/bin/sh' DOCKERHUB_CREDENTIALS = credentials('dockerhub') } stages { - stage('Build image for toolng-app') { + stage('Build image for tooling-app') { steps { - sh 'docker build -t stlng/tooling-feature:0.0.1 .' + sh 'docker build -t stlng/tooling-master:0.0.2 .' } } + + stage('Build container for tooling-app') { + steps { + sh 'docker compose -f tooling.yml up -d' + } + } + + stage('Test Stage') { + steps { + httpRequest url:"http://localhost:5000", + validResponseCodes:'200' + + echo "HTTP response status code: ${status_code}" + + if (status_code != "200") { + error('URL status different from 200. FAILURE') + } + } + } + stage('Login to docker hub') { steps { sh 'echo $DOCKERHUB_CREDENTIALS_PSW | docker login -u $DOCKERHUB_CREDENTIALS_USR --password-stdin' } } + stage('Push docker image to docker hub registry') { steps { - sh 'docker push stlng/tooling-feature:0.0.1' + sh 'docker push stlng/tooling-master:0.0.2' } } - } + post { always { sh 'docker logout' + // Clean after build + sh 'docker compose -f tooling.yml down' + sh 'docker rmi stlng/tooling-master:0.0.2' + } + } } } -} \ No newline at end of file diff --git a/Jenkinsfile.bak b/Jenkinsfile.bak new file mode 100644 index 0000000..854cda1 --- /dev/null +++ b/Jenkinsfile.bak @@ -0,0 +1,32 @@ +pipeline { + agent any + options { + buildDiscarder(logRotator(numToKeepStr: '5')) + } + environment { + PATH = '/usr/bin/sh' + DOCKERHUB_CREDENTIALS = credentials('dockerhub') + } + stages { + stage('Build image for toolng-app') { + steps { + sh 'docker build -t stlng/tooling-master:0.0.1 .' + } + } + stage('Login to docker hub') { + steps { + sh 'echo $DOCKERHUB_CREDENTIALS_PSW | docker login -u $DOCKERHUB_CREDENTIALS_USR --password-stdin' + } + } + stage('Push docker image to docker hub registry') { + steps { + sh 'docker push stlng/tooling-master:0.0.1' + } + } + } + post { + always { + sh 'docker logout' + } + } +} \ No newline at end of file diff --git a/create_user.sql b/create_user.sql new file mode 100644 index 0000000..3da2b59 --- /dev/null +++ b/create_user.sql @@ -0,0 +1 @@ +CREATE USER ''@'%' IDENTIFIED BY ''; GRANT ALL PRIVILEGES ON * . * TO ''@'%'; \ No newline at end of file diff --git a/docker b/docker new file mode 100644 index 0000000..8804619 --- /dev/null +++ b/docker @@ -0,0 +1,10 @@ +Command 'shell' not found, did you mean: + command 'spell' from deb spell (1.0-24.2) + command 'rshell' from deb pyboard-rshell (0.0.31-0ubuntu1) + command 'bshell' from deb avahi-ui-utils (0.8-5ubuntu5) + command 'jshell' from deb openjdk-11-jdk-headless (11.0.18+10-0ubuntu1~22.04) + command 'jshell' from deb openjdk-17-jdk-headless (17.0.6+10-0ubuntu1~22.04) + command 'jshell' from deb openjdk-18-jdk-headless (18.0.2+9-2~22.04) + command 'jshell' from deb openjdk-19-jdk-headless (19.0.2+7-0ubuntu3~22.04) + command 'shelr' from deb shelr (0.16.3-2.1) +Try: sudo apt install diff --git a/html/.env b/html/.env index 5d54ccf..5085de5 100644 --- a/html/.env +++ b/html/.env @@ -3,4 +3,4 @@ MYSQL_IP=mysqlserverhost MYSQL_USER= MYSQL_PASS= -MYSQL_DBNAME=toolingdb \ No newline at end of file +MYSQL_DBNAME=toolingdb diff --git a/tooling.bak b/tooling.bak new file mode 100644 index 0000000..571cf42 --- /dev/null +++ b/tooling.bak @@ -0,0 +1,39 @@ +version: "3.9" +services: + tooling_frontend: + build: . + container_name: tooling + ports: + - "5000:80" + volumes: + - tooling_frontend:/var/www/html + networks: + - tooling_app_network + links: + - db + db: + image: mysql/mysql-server:latest + container_name: mysqlserverhost + ports: + - 3306:3306 + restart: always + environment: + # MYSQL_DATABASE: 'toolingdb' + # MYSQL_USER: '' + # MYSQL_PASSWORD: '' + # MYSQL_RANDOM_ROOT_PASSWORD: '1' + + MYSQL_DATABASE: '${MYSQL_DBNAME}' + MYSQL_USER: '${MYSQL_USER}' + MYSQL_PASSWORD: '${MYSQL_PASS}' + MYSQL_RANDOM_ROOT_PASSWORD: '1' + volumes: + - db:/var/lib/mysql + networks: + - tooling_app_network +volumes: + tooling_frontend: + db: +networks: + tooling_app_network : {} + \ No newline at end of file diff --git a/tooling.yml b/tooling.yml new file mode 100644 index 0000000..f971791 --- /dev/null +++ b/tooling.yml @@ -0,0 +1,23 @@ +version: "3.1" +services: + tooling_frontend: + image: stlng/tooling-master:0.0.2 + ports: + - "5000:80" + volumes: + - tooling_frontend:/var/www/html + links: + - db + db: + image: mysql:5.7 + restart: always + environment: + MYSQL_DATABASE: '${MYSQL_DBNAME}' + MYSQL_USER: '${MYSQL_USER}' + MYSQL_PASSWORD: '${MYSQL_PASS}' + MYSQL_RANDOM_ROOT_PASSWORD: '1' + volumes: + - db:/var/lib/mysql +volumes: + tooling_frontend: + db: \ No newline at end of file From c3fc9d3b5173716b7a6d1b772da1371ce5a2ce35 Mon Sep 17 00:00:00 2001 From: Femi Solagbade Date: Thu, 20 Apr 2023 17:41:06 +0100 Subject: [PATCH 11/16] update --- Jenkinsfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2ba639c..3f9e984 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -25,11 +25,11 @@ pipeline { httpRequest url:"http://localhost:5000", validResponseCodes:'200' - echo "HTTP response status code: ${status_code}" + // echo "HTTP response status code: ${status_code}" - if (status_code != "200") { - error('URL status different from 200. FAILURE') - } + // if (status_code != "200") { + // error('URL status different from 200. FAILURE') + // } } } From 0e5207e7f0e1de2f03b62f72ba5d758b310ef4a5 Mon Sep 17 00:00:00 2001 From: Femi Solagbade Date: Fri, 21 Apr 2023 13:38:58 +0100 Subject: [PATCH 12/16] update --- Jenkinsfile | 60 +++++++++++++++++++++++------------------------- Jenkinsfile.bk1 | 61 +++++++++++++++++++++++++++++++++++++++++++++++++ tooling.yml | 6 ++--- 3 files changed, 91 insertions(+), 36 deletions(-) create mode 100644 Jenkinsfile.bk1 diff --git a/Jenkinsfile b/Jenkinsfile index 3f9e984..a487886 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,54 +4,50 @@ pipeline { buildDiscarder(logRotator(numToKeepStr: '5')) } environment { - PATH = '/usr/bin/sh' DOCKERHUB_CREDENTIALS = credentials('dockerhub') } + stages { - stage('Build image for tooling-app') { - steps { - sh 'docker build -t stlng/tooling-master:0.0.2 .' - } - } - - stage('Build container for tooling-app') { + stage('Build image for php-todo-app') { steps { - sh 'docker compose -f tooling.yml up -d' + sh 'docker build -t stlng/tooling-master:0.0.1 .' } } - stage('Test Stage') { + stage('Test Stage: testing endpoint') { steps { - httpRequest url:"http://localhost:5000", - validResponseCodes:'200' - - // echo "HTTP response status code: ${status_code}" - - // if (status_code != "200") { - // error('URL status different from 200. FAILURE') - // } - } - } + sh 'docker-compose -f tooling.yml up -d' - stage('Login to docker hub') { - steps { + script { + while (true) { + def response = httpRequest 'http://localhost:5000' + if (response.status == 200) { sh 'echo $DOCKERHUB_CREDENTIALS_PSW | docker login -u $DOCKERHUB_CREDENTIALS_USR --password-stdin' - } - } + } + break + } + } + } + } stage('Push docker image to docker hub registry') { + when { expression { response.status == 200 } } steps { - sh 'docker push stlng/tooling-master:0.0.2' + sh 'docker push stlng/tooling-master:0.0.1' } } - post { - always { - sh 'docker logout' - // Clean after build - sh 'docker compose -f tooling.yml down' - sh 'docker rmi stlng/tooling-master:0.0.2' + stage('Cleaning up') { + steps{ + sh 'docker compose -f tooling.yml down' + sh 'docker rmi tooling-master:0.0.1' + } + } + + post { + always { + sh 'docker logout' } } } - } + } \ No newline at end of file diff --git a/Jenkinsfile.bk1 b/Jenkinsfile.bk1 new file mode 100644 index 0000000..f90ba78 --- /dev/null +++ b/Jenkinsfile.bk1 @@ -0,0 +1,61 @@ +pipeline { + agent any + options { + buildDiscarder(logRotator(numToKeepStr: '5')) + } + environment { + PATH = '/usr/bin/sh' + DOCKERHUB_CREDENTIALS = credentials('dockerhub') + } + stages { + stage('Build image for tooling-app') { + steps { + sh 'docker build -t stlng/tooling-master:0.0.2 .' + } + } + + stage('Build container for tooling-app') { + steps { + sh 'docker compose -f tooling.yml up -d' + } + } + + stage('Test Stage') { + steps { + httpRequest url:"http://localhost:5000", + validResponseCodes:'200' + + // echo "HTTP response status code: ${status_code}" + + // if (status_code != "200") { + // error('URL status different from 200. FAILURE') + // } + } + } + + stage('Login to docker hub') { + steps { + sh 'echo $DOCKERHUB_CREDENTIALS_PSW | docker login -u $DOCKERHUB_CREDENTIALS_USR --password-stdin' + } + } + + stage('Push docker image to docker hub registry') { + steps { + sh 'docker push stlng/tooling-master:0.0.2' + } + } + + stage('docker hub logout') { + steps{ + sh 'docker logout' + } + } + + post { + always { + cleanWs() + sh 'docker compose -f tooling.yml down' + } + } + } + } \ No newline at end of file diff --git a/tooling.yml b/tooling.yml index 846a6fa..4f0284c 100644 --- a/tooling.yml +++ b/tooling.yml @@ -1,8 +1,7 @@ - -version: "3.1" +version: "3.9" services: tooling_frontend: - image: stlng/tooling-master:0.0.2 + image: stlng/tooling-master:0.0.1 ports: - "5000:80" volumes: @@ -17,7 +16,6 @@ services: MYSQL_USER: '${MYSQL_USER}' MYSQL_PASSWORD: '${MYSQL_PASS}' MYSQL_RANDOM_ROOT_PASSWORD: '1' - volumes: - db:/var/lib/mysql volumes: From c9be82a1a7f414fe7475f7e719e9f27bf932b636 Mon Sep 17 00:00:00 2001 From: stlng1 <101927258+stlng1@users.noreply.github.com> Date: Fri, 21 Apr 2023 14:25:43 +0100 Subject: [PATCH 13/16] update --- .env | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .env diff --git a/.env b/.env new file mode 100644 index 0000000..ed147e1 --- /dev/null +++ b/.env @@ -0,0 +1,7 @@ +MYSQL_IP=mysqlserverhost +MYSQL_USER= +MYSQL_PASS= +MYSQL_DBNAME=toolingdb + +env.BRANCH_NAME=feature +env.BUILD_NUMBER='0.0.1' From 7d796d37f0ee5d3d11b9c06fecb0119019e5168a Mon Sep 17 00:00:00 2001 From: stlng1 <101927258+stlng1@users.noreply.github.com> Date: Fri, 21 Apr 2023 14:27:04 +0100 Subject: [PATCH 14/16] update --- Jenkinsfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a487886..f9e294b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,7 +10,7 @@ pipeline { stages { stage('Build image for php-todo-app') { steps { - sh 'docker build -t stlng/tooling-master:0.0.1 .' + sh 'docker build -t stlng/tooling-${env.BRANCH_NAME}:${env.BUILD_NUMBER} .' } } @@ -33,14 +33,14 @@ pipeline { stage('Push docker image to docker hub registry') { when { expression { response.status == 200 } } steps { - sh 'docker push stlng/tooling-master:0.0.1' + sh 'docker push stlng/tooling-${env.BRANCH_NAME}:${env.BUILD_NUMBER}' } } stage('Cleaning up') { steps{ sh 'docker compose -f tooling.yml down' - sh 'docker rmi tooling-master:0.0.1' + sh 'docker rmi tooling-${env.BRANCH_NAME}:${env.BUILD_NUMBER}' } } @@ -50,4 +50,4 @@ pipeline { } } } - } \ No newline at end of file + } From 0d5139e28aca11bda7da3d09b11409fdb1c6bc60 Mon Sep 17 00:00:00 2001 From: stlng1 <101927258+stlng1@users.noreply.github.com> Date: Fri, 21 Apr 2023 14:30:45 +0100 Subject: [PATCH 15/16] update --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index f9e294b..24d3136 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,7 +8,7 @@ pipeline { } stages { - stage('Build image for php-todo-app') { + stage('Build image for tooling-app') { steps { sh 'docker build -t stlng/tooling-${env.BRANCH_NAME}:${env.BUILD_NUMBER} .' } From dc08c906a05059a0f3bb26638742cf61be78a75c Mon Sep 17 00:00:00 2001 From: stlng1 <101927258+stlng1@users.noreply.github.com> Date: Fri, 21 Apr 2023 14:32:05 +0100 Subject: [PATCH 16/16] update --- tooling.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tooling.yml b/tooling.yml index 4f0284c..058c2e3 100644 --- a/tooling.yml +++ b/tooling.yml @@ -1,7 +1,7 @@ version: "3.9" services: tooling_frontend: - image: stlng/tooling-master:0.0.1 + image: stlng/tooling-${env.BRANCH_NAME}:${env.BUILD_NUMBER} ports: - "5000:80" volumes: @@ -20,4 +20,4 @@ services: - db:/var/lib/mysql volumes: tooling_frontend: - db: \ No newline at end of file + db: