diff --git a/Dockerfile b/Dockerfile index f375d141..b006bd5e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM node:carbon WORKDIR /usr/src/app COPY package*.json ./ -RUN npm install +RUN npm ci COPY . . EXPOSE 8080 -CMD [ "npm", "start" ] \ No newline at end of file +CMD [ "npm", "start" ] diff --git a/Jenkinsfile b/Jenkinsfile index e3e8fb3b..ffbe70cf 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,5 +8,28 @@ pipeline { archiveArtifacts artifacts: 'dist/trainSchedule.zip' } } + stage('Build Docker Image') { + steps { + script { + app = docker.build("aglorei/train-schedule") + app.inside { + sh 'echo $(curl localhost:8080)' + } + } + } + } + stage('Push Docker Image') { + when { + branch 'master' + } + steps { + script { + docker.withRegistry('https://registry.hub.docker.com', 'docker_hub_login') { + app.push("${env.BUILD_NUMBER}") + app.push("latest") + } + } + } + } } -} \ No newline at end of file +}