diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index ff8b3e3..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Datasource local storage ignored files -/../../../../../../:\nclazz.de\src\www\www.nclazz.de\.idea/dataSources/ -/dataSources.local.xml -# Editor-based HTTP Client requests -/httpRequests/ diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index ce7c471..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 64ffc39..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1dd..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/www.nclazz.de.iml b/.idea/www.nclazz.de.iml deleted file mode 100644 index d6ebd48..0000000 --- a/.idea/www.nclazz.de.iml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3d47428 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,2 @@ +FROM docker.nclazz.de/nclazz/static-webserver:latest +COPY ./site . \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..25010c2 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,71 @@ +pipeline { + agent any + + environment { + DOCKER_REGISTRY = "docker.nclazz.de" + DOCKER_GROUP = 'nclazz' + DOCKER_IMAGE = 'site' + DOCKER_TAG = 'latest' + + DEPLOY_NODE = "${ BRANCH_NAME == "master" ? "swarm && prod" : "swarm && staging" }" + SERVICE_NAME = 'marrone-international' + } + + stages { + stage('Run Docker Build') { + agent { label 'docker' } + steps { + sh 'chmod +x version.sh' + sh './version.sh > site/version.json' + script { + docker.withRegistry("https://$DOCKER_REGISTRY", "jenkins_nexus") { + def image = docker.build("nclazz/site") + image.push("${env.DOCKER_TAG}") + } + } + } + } + stage('Run Deployment') { + agent { label "provision" } + when { + branch 'master' + } + steps { + deployToSwarm( + name: 'www-nclazz', + file: "${env.WORKSPACE}/docker-compose.yml", + forceUpdate: true, + askApproval: false, + slackChannel: 'deployment' + ) + } + } + } + + post { + always { + cleanWs() + } + failure { + slackSend( + channel: 'notifications', + color: 'danger', + message: "There is a *build failure* in ${env.JOB_NAME}.\nBuild: ${env.BUILD_URL} " + ) + } + unstable { + slackSend( + channel: 'notifications', + color: 'warning', + message: "Some tests have failed in ${env.JOB_NAME}.\nBuild: ${env.BUILD_URL} " + ) + } + fixed { + slackSend( + channel: 'notifications', + color: 'good', + message: "The build ${env.JOB_NAME} completed successfully and is back to normal.\nBuild: ${env.BUILD_URL} " + ) + } + } +} \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..c53efad --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +version: '3.8' +services: + site: + deploy: + replicas: 2 + placement: + max_replicas_per_node: 1 + image: docker.nclazz.de/nclazz/site:latest + ports: + - 9082:80 \ No newline at end of file diff --git a/favicon-16x16.png b/site/favicon-16x16.png similarity index 100% rename from favicon-16x16.png rename to site/favicon-16x16.png diff --git a/favicon-32x32.png b/site/favicon-32x32.png similarity index 100% rename from favicon-32x32.png rename to site/favicon-32x32.png diff --git a/favicon.ico b/site/favicon.ico similarity index 100% rename from favicon.ico rename to site/favicon.ico diff --git a/img/logo_light.png b/site/img/logo_light.png similarity index 100% rename from img/logo_light.png rename to site/img/logo_light.png diff --git a/img/logo_rect.png b/site/img/logo_rect.png similarity index 100% rename from img/logo_rect.png rename to site/img/logo_rect.png diff --git a/index.html b/site/index.html similarity index 100% rename from index.html rename to site/index.html diff --git a/site.webmanifest b/site/site.webmanifest similarity index 100% rename from site.webmanifest rename to site/site.webmanifest diff --git a/styles/main.css b/site/styles/main.css similarity index 100% rename from styles/main.css rename to site/styles/main.css diff --git a/styles/theme.css b/site/styles/theme.css similarity index 100% rename from styles/theme.css rename to site/styles/theme.css diff --git a/version.sh b/version.sh new file mode 100644 index 0000000..c7e3684 --- /dev/null +++ b/version.sh @@ -0,0 +1,2 @@ +#!/bin/bash +echo "{ \"commit\": \"$GIT_COMMIT\", \"build\": \"$BUILD_ID\" }" \ No newline at end of file