Compare commits

...

10 Commits

Author SHA1 Message Date
Sebastian Seedorf
632467eb68 Wording 2022-01-26 02:35:55 +01:00
Sebastian Seedorf
01172c6c8d Upgrade to node 16 2022-01-26 00:50:02 +01:00
Sebastian Seedorf
b9683033cd Changed naming 2022-01-26 00:21:23 +01:00
Sebastian Seedorf
143af212f0 Fixed Jenkinsfile 2022-01-26 00:14:02 +01:00
Sebastian Seedorf
715acbcff7 Merge remote-tracking branch 'origin/master' 2022-01-26 00:07:17 +01:00
Sebastian Seedorf
b7c8724416 Added a word 2022-01-26 00:06:47 +01:00
Sebastian Seedorf
5d456ee817 Added Jenkinsfile 15 2021-04-19 14:42:13 +02:00
Sebastian Seedorf
32e245d474 Added Jenkinsfile 14 2021-04-19 14:15:09 +02:00
Sebastian Seedorf
dfe2350cb0 Added Jenkinsfile 13 2021-04-19 14:14:01 +02:00
Sebastian Seedorf
3f04e4436b Added Jenkinsfile 12 2021-04-19 14:12:47 +02:00
5 changed files with 1283 additions and 129 deletions

View File

@@ -1,11 +1,15 @@
FROM node:15-alpine
FROM node:16-alpine
WORKDIR /app
ENV NODE_ENV=production
COPY ./public /app/public
COPY ./views /app/views
COPY ./dist /app/views
COPY ./dist /app/dist
COPY ./package.json /app/package.json
COPY ./package-lock.json /app/package-lock.json
RUN npm install
ENTRYPOINT npm start
EXPOSE 3000
EXPOSE 3000

176
Jenkinsfile vendored
View File

@@ -1,122 +1,66 @@
#!groovy
/*
The MIT License
Copyright (c) 2015-, CloudBees, Inc., and a number of other of contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
node {
sh 'git rev-parse --verify HEAD > GIT_COMMIT'
env.GIT_COMMIT = readFile('GIT_COMMIT').trim().substring(0, 10)
sh 'rm GIT_COMMIT'
def jobName = env.JOB_NAME.tokenize('/')
print env.jobName
env.DOCKER_NAME="${jobName[0]}/${jobName[1]}:${env.BRANCH_NAME}-${env.GIT_COMMIT}"
env.NODEJS_HOME = "${tool 'node14'}"
env.PATH="${env.NODEJS_HOME}/bin:${env.PATH}"
def customImage
currentBuild.result = "SUCCESS"
try {
stage('Checkout'){
checkout scm
}
stage('Test'){
env.NODE_ENV = "test"
print "Environment will be : ${env.NODE_ENV}"
sh 'node -v'
sh 'npm prune'
sh 'npm install'
//sh 'npm test'
}
stage('Build Prod'){
env.NODE_ENV = "production"
print "Environment will be : ${env.NODE_ENV}"
sh 'node -v'
sh 'npm prune'
sh 'npm install -DP'
sh './node_modules/.bin/tsc'
sh 'rm node_modules -rf'
sh 'npm install --only=production'
}
stage('Build Docker'){
customImage = docker.build(env.DOCKER_NAME)
}
stage('Deploy'){
echo 'Push to Repo'
docker.withRegistry('https://docker.sebse.de', 'docker-registry-robot-web-development') {
/* Push the container to the custom Registry */
customImage.push()
}
/*echo 'ssh to web server and tell it to pull new image'
sh 'ssh deploy@xxxxx.xxxxx.com running/xxxxxxx/dockerRun.sh'*/
}
stage('Cleanup'){
echo 'prune and cleanup'
sh 'npm prune'
sh 'rm node_modules -rf'
/*mail body: 'project build successful',
from: 'xxxx@yyyyy.com',
replyTo: 'xxxx@yyyy.com',
subject: 'project build successful',
to: 'yyyyy@yyyy.com'*/
}
}
catch (err) {
currentBuild.result = "FAILURE"
/*mail body: "project build error is here: ${env.BUILD_URL}" ,
from: 'xxxx@yyyy.com',
replyTo: 'yyyy@yyyy.com',
subject: 'project build failed',
to: 'zzzz@yyyyy.com'*/
throw err
stage('Checkout') {
checkout scm
}
stage('Prepare') {
sh 'git rev-parse --verify HEAD > GIT_COMMIT'
env.GIT_COMMIT = readFile('GIT_COMMIT').trim().substring(0, 10)
sh 'rm GIT_COMMIT'
def jobName = env.JOB_NAME.tokenize('/')
print env.jobName
// set env
env.DOCKER_NAME="${jobName[0]}/${jobName[1]}:${env.BRANCH_NAME}-${env.GIT_COMMIT}"
env.DOCKER_REGISTRY="docker.sebse.de"
env.NODEJS_HOME = "${tool 'node16'}"
env.PATH="${env.NODEJS_HOME}/bin:${env.PATH}"
def customImage
}
/*stage('Test') {
env.NODE_ENV = "test"
print "Environment will be : ${env.NODE_ENV}"
sh 'node -v'
sh 'npm prune'
sh 'npm install'
sh 'npm test'
}*/
stage('Build Prod') {
env.NODE_ENV = "production"
print "Environment will be : ${env.NODE_ENV}"
sh 'node -v'
sh 'npm prune'
sh 'npm install --production=false'
sh 'npm run build'
sh 'rm node_modules -rf'
sh 'npm install --only=production'
}
stage('Build Docker') {
customImage = docker.build(env.DOCKER_NAME)
}
stage('Deploy') {
echo 'Push to Repo'
docker.withRegistry("https://${DOCKER_REGISTRY}", 'docker-registry-robot-web-development') {
/* Push the container to the custom Registry */
customImage.push()
}
}
stage('Cleanup') {
echo 'prune and cleanup'
sh 'npm prune'
sh 'rm node_modules -rf'
sh "docker rmi ${env.DOCKER_NAME} ${DOCKER_REGISTRY}/${env.DOCKER_NAME}"
sh 'docker image prune -f'
sh 'docker rmi $(docker images -a | grep "<none>" | awk "{print \$3}") &2>/del/null || exit 0'
}
}

1207
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -4,13 +4,19 @@
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node ./dist/index.js",
"dev": "tsc-watch --onSuccess \"node ./dist/index.js\""
"dev": "tsc-watch --onSuccess \"node ./dist/index.js\" --onFailure \"echo Beep! Compilation Failed\"",
"build": "tsc",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.17.1",
"node-fetch": "^2.6.1",
"pug": "^3.0.2"
},
"devDependencies": {
"@types/express": "^4.17.11",
"@types/node": "^14.14.41",
@@ -18,10 +24,5 @@
"@types/pug": "^2.0.4",
"tsc-watch": "^4.2.9",
"typescript": "^4.2.4"
},
"dependencies": {
"express": "^4.17.1",
"node-fetch": "^2.6.1",
"pug": "^3.0.2"
}
}

View File

@@ -9,7 +9,7 @@ block body
span.big-number(data-value=firstVac) #{firstVac}
| haben bisher mindestens eine Impfung erhalten, davon &#32;
span.big-number(data-value=secondVac) #{secondVac}
| schon die zweite Impfung.
| schon mindestens die zweite Impfung.
p
| Wenn das so weiter geht, dann haben 80% am
p.mega-date(data-value=finalDate.getTime()) #{finalDate.toLocaleDateString(locale, { year: 'numeric', month: 'numeric', day: 'numeric' })}
@@ -18,4 +18,4 @@ block body
p.footer.margin-top Quelle: &#32;
a(href="https://impfdashboard.de/") Offizelle Datensätze tagesaktuell bereitgestellt durch das RKI und das BMG
p.footer Quelle: &#32;
a(href="/impressum") Impressum & Datenschutzerklärung
a(href="/impressum") Impressum & Datenschutzerklärung