diff --git a/Dockerfile b/Dockerfile index 1ab42ca1..0c55ff47 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,5 +17,5 @@ EXPOSE 27017 EXPOSE 5000 #RUN rm /home/sunbird/mw/content/services/js-services/content_service/content_service.zip #RUN rm /home/sunbird/mw/content_service.zip -WORKDIR /home/sunbird/mw/content/src +WORKDIR /home/sunbird/mw/content/ CMD ["node", "app.js", "&"] \ No newline at end of file diff --git a/Dockerfile.Build b/Dockerfile.Build index ec25181c..ba5c4546 100644 --- a/Dockerfile.Build +++ b/Dockerfile.Build @@ -3,8 +3,9 @@ MAINTAINER "Manojvv" "manojv@ilimi.in" RUN apk update \ && apk add zip \ && mkdir -p /opt/content -ADD content /opt/content/ -WORKDIR /opt/content/src +ADD src /opt/content/ +ADD sunbird-js-utils /opt/content/ +WORKDIR /opt/content/ RUN npm install --unsafe-perm WORKDIR /opt CMD ["zip", "-r", "content_service.zip", "content"] \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile index 2419c324..ab7dc5de 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,8 +16,8 @@ node('build-slave') { env.NODE_ENV = "build" print "Environment will be : ${env.NODE_ENV}" - sh('chmod 777 content/build.sh') - sh('./content/build.sh') + sh('chmod 777 build.sh') + sh('./build.sh') } @@ -28,9 +28,9 @@ node('build-slave') { dir('.') { - sh('chmod 777 ./content/dockerPushToRepo.sh') - sh 'ARTIFACT_LABEL=bronze ./content/dockerPushToRepo.sh' - sh './content/src/metadata.sh > metadata.json' + sh('chmod 777 ./dockerPushToRepo.sh') + sh 'ARTIFACT_LABEL=bronze ./dockerPushToRepo.sh' + sh './src/metadata.sh > metadata.json' sh 'cat metadata.json' archive includes: "metadata.json" } diff --git a/build.sh b/build.sh index 8a2e709a..e6647e68 100755 --- a/build.sh +++ b/build.sh @@ -4,12 +4,13 @@ e () { echo $( echo ${1} | jq ".${2}" | sed 's/\"//g') } -m=$(./content/src/metadata.sh) +m=$(./src/metadata.sh) org=$(e "${m}" "org") name=$(e "${m}" "name") version=$(e "${m}" "version") + docker build -f ./Dockerfile.Build -t ${org}/${name}:${version}-build . docker run --name=${name}-${version}-build ${org}/${name}:${version}-build containerid=`docker ps -aqf "name=${name}-${version}-build"` diff --git a/deploy.sh b/deploy.sh index 3a71b359..f6f3678b 100644 --- a/deploy.sh +++ b/deploy.sh @@ -4,7 +4,7 @@ e () { echo $( echo ${1} | jq ".${2}" | sed 's/\"//g') } -m=$(./content/src/metadata.sh) +m=$(./src/metadata.sh) org=$(e "${m}" "org") name=$(e "${m}" "name") diff --git a/dockerPushToRepo.sh b/dockerPushToRepo.sh index 343b2bda..747aa82b 100644 --- a/dockerPushToRepo.sh +++ b/dockerPushToRepo.sh @@ -4,7 +4,7 @@ e () { echo $( echo ${1} | jq ".${2}" | sed 's/\"//g') } -m=$(./content/src/metadata.sh) +m=$(./src/metadata.sh) org=$(e "${m}" "org") hubuser=$(e "${m}" "hubuser")