diff --git a/Dockerfile b/Dockerfile index 6e94dc9a..bdfd5c12 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,10 +23,11 @@ RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \ && apt-get install -y --no-install-recommends nodejs \ && rm -rf /var/lib/apt/lists/* +RUN a2dissite 000-default + +ARG STAMP=unknown RUN apt-get update \ && apt-get install -y hedera-web \ && rm -rf /var/lib/apt/lists/* -RUN a2dissite 000-default - CMD ["apachectl", "-D", "FOREGROUND"] diff --git a/Jenkinsfile b/Jenkinsfile index 20d15083..fe1e443f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,27 +4,59 @@ pipeline { environment { PROJECT_NAME = 'hedera-web' } - agent { - docker { - image 'registry.verdnatura.es/vn-debuild' - registryUrl 'https://registry.verdnatura.es/' - registryCredentialsId 'docker-registry' - args '-v /mnt/storage/reprepro:/reprepro' - } - } stages { stage('Checkout') { steps { + configFileProvider([ + configFile(fileId: "${PROJECT_NAME}.groovy", + variable: 'GROOVY_FILE') + ]) { + load env.GROOVY_FILE + } + sh 'printenv' } } + stage('Package') { + when { + branch 'master' + } + agent { + docker { + image 'registry.verdnatura.es/vn-debuild' + registryUrl 'https://registry.verdnatura.es/' + registryCredentialsId 'docker-registry' + args '-v /mnt/storage/reprepro:/reprepro' + } + } + steps { + sh 'debuild -us -uc -b' + sh 'vn-includedeb' + } + } + stage('Build') { + when { + branch 'master' + } + environment { + CREDS = credentials('docker-registry') + } + steps { + nodejs('node-lts') { + sh 'gulp build' + } + + sh 'docker login --username $CREDS_USR --password $CREDS_PSW $REGISTRY' + sh 'docker-compose build --parallel' + sh 'docker-compose push' + } + } stage('Deploy') { when { branch 'master' } steps { - sh 'debuild -us -uc -b' - sh 'vn-includedeb' + sh "docker stack deploy --with-registry-auth --compose-file docker-compose.yml ${env.PROJECT_NAME}" } } } diff --git a/debian/postinst b/debian/postinst index 7609a380..56aab06c 100755 --- a/debian/postinst +++ b/debian/postinst @@ -8,8 +8,8 @@ if [ -e /usr/share/apache2/apache2-maintscript-helper ] then . /usr/share/apache2/apache2-maintscript-helper apache2_invoke enconf hedera-web.conf + apache2_invoke enmod rewrite headers fi #service php7.3-fpm restart #service cron restart - diff --git a/docker-compose.yml b/docker-compose.yml index e2e5a2e3..e41bcc61 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -29,4 +29,4 @@ configs: name: ${PROJECT_NAME:?}_test apache: external: true - name: ${PROJECT_NAME:?}_apache \ No newline at end of file + name: ${PROJECT_NAME:?}_apache