Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -1,17 +1,15 @@
|
|||||||
FROM node:15-alpine
|
FROM node:15-alpine
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
|
||||||
COPY ./public /app/public
|
COPY ./public /app/public
|
||||||
COPY ./src /app/src
|
|
||||||
COPY ./views /app/views
|
COPY ./views /app/views
|
||||||
|
COPY ./dist /app/dist
|
||||||
COPY ./package.json /app/package.json
|
COPY ./package.json /app/package.json
|
||||||
COPY ./package-lock.json /app/package-lock.json
|
COPY ./package-lock.json /app/package-lock.json
|
||||||
COPY ./tsconfig.json /app/tsconfig.json
|
|
||||||
|
|
||||||
RUN npm install && ./node_modules/.bin/tsc && rm -rf node_modules src tsconfig.json
|
RUN npm install
|
||||||
ENV NODE_ENV=production
|
|
||||||
RUN npm install --only=production && rm -rf package-lock.json
|
|
||||||
|
|
||||||
ENTRYPOINT npm start
|
ENTRYPOINT npm start
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
43
Jenkinsfile
vendored
43
Jenkinsfile
vendored
@@ -22,9 +22,19 @@ THE SOFTWARE.
|
|||||||
|
|
||||||
node {
|
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.DOCKER_REGISTRY="docker.sebse.de"
|
||||||
|
|
||||||
env.NODEJS_HOME = "${tool 'node14'}"
|
env.NODEJS_HOME = "${tool 'node14'}"
|
||||||
env.PATH="${env.NODEJS_HOME}/bin:${env.PATH}"
|
env.PATH="${env.NODEJS_HOME}/bin:${env.PATH}"
|
||||||
|
|
||||||
|
def customImage
|
||||||
|
|
||||||
|
|
||||||
currentBuild.result = "SUCCESS"
|
currentBuild.result = "SUCCESS"
|
||||||
|
|
||||||
@@ -48,26 +58,47 @@ node {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*stage('Build Docker'){
|
stage('Build Prod'){
|
||||||
|
|
||||||
sh './dockerBuild.sh'
|
env.NODE_ENV = "production"
|
||||||
|
|
||||||
|
print "Environment will be : ${env.NODE_ENV}"
|
||||||
|
|
||||||
|
sh 'node -v'
|
||||||
|
sh 'npm prune'
|
||||||
|
sh 'npm install --production=false'
|
||||||
|
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'){
|
stage('Deploy'){
|
||||||
|
|
||||||
echo 'Push to Repo'
|
echo 'Push to Repo'
|
||||||
sh './dockerPushToRepo.sh'
|
docker.withRegistry("https://${DOCKER_REGISTRY}", 'docker-registry-robot-web-development') {
|
||||||
|
|
||||||
echo 'ssh to web server and tell it to pull new image'
|
/* Push the container to the custom Registry */
|
||||||
sh 'ssh deploy@xxxxx.xxxxx.com running/xxxxxxx/dockerRun.sh'
|
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'){
|
stage('Cleanup'){
|
||||||
|
|
||||||
echo 'prune and cleanup'
|
echo 'prune and cleanup'
|
||||||
sh 'npm prune'
|
sh 'npm prune'
|
||||||
sh 'rm node_modules -rf'
|
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'
|
||||||
|
|
||||||
/*mail body: 'project build successful',
|
/*mail body: 'project build successful',
|
||||||
from: 'xxxx@yyyyy.com',
|
from: 'xxxx@yyyyy.com',
|
||||||
|
|||||||
1207
package-lock.json
generated
1207
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user