diff --git a/geoportal/Dockerfile b/geoportal/Dockerfile index 5722f87d3..c8e521d3a 100644 --- a/geoportal/Dockerfile +++ b/geoportal/Dockerfile @@ -11,10 +11,25 @@ RUN \ COPY webpack.*.js Makefile CONST_Makefile /app/ COPY geoportailv3_geoportal/static-ngeo /app/geoportailv3_geoportal/static-ngeo -RUN make apps +# RUN make apps COPY . /app +# jsapi generation +RUN mkdir /etc/apiv3 +WORKDIR /etc/apiv3 +RUN node --version +RUN mkdir -p /etc/apiv3/.build/externs && mkdir -p /etc/apiv3/build +RUN curl -s https://raw.githubusercontent.com/google/closure-compiler/master/contrib/externs/angular-1.6.js -o /etc/apiv3/.build/externs/angular-1.6.js && \ + curl -s https://raw.githubusercontent.com/google/closure-compiler/master/contrib/externs/angular-1.6-q_templated.js -o /etc/apiv3/.build/externs/angular-1.6-q_templated.js && \ + curl -s https://raw.githubusercontent.com/google/closure-compiler/master/contrib/externs/angular-1.6-http-promise_templated.js -o /etc/apiv3/.build/externs/angular-1.6-http-promise_templated.js && \ + curl -s https://raw.githubusercontent.com/google/closure-compiler/master/contrib/externs/jquery-1.9.js -o /etc/apiv3/.build/externs/jquery-1.9.js +COPY ./jsapi/package.json /etc/apiv3/ +RUN npm install --no-optional && npm cache clear --force +ADD ./jsapi /etc/apiv3/jsapi +RUN /etc/apiv3/jsapi/rebuild_api.sh + + # RUN make checks RUN make build RUN mv webpack.apps.js webpack.apps.js.tmpl @@ -36,6 +51,7 @@ COPY . /app COPY --from=builder /app/geoportailv3_geoportal/locale/ /app/geoportailv3_geoportal/locale/ COPY --from=builder /usr/lib/node_modules/ngeo/dist/* /etc/static-ngeo/ COPY --from=builder /etc/static-ngeo/* /etc/static-ngeo/ +COPY --from=builder /etc/apiv3/* /etc/apiv3/ COPY --from=builder /app/alembic.ini /app/alembic.yaml ./ RUN chmod go+w /etc/static-ngeo/ \ /app/geoportailv3_geoportal/locale/ \ diff --git a/geoportal/jsapi/config.json b/geoportal/jsapi/config.json index 1fc952d2a..f775383b6 100644 --- a/geoportal/jsapi/config.json +++ b/geoportal/jsapi/config.json @@ -18,28 +18,28 @@ "exports": ["*"], "compile": { "externs": [ - "/opt/apiv3/node_modules/openlayers/externs/bingmaps.js", - "/opt/apiv3/node_modules/openlayers/externs/cartodb.js", - "/opt/apiv3/node_modules/openlayers/externs/closure-compiler.js", - "/opt/apiv3/node_modules/openlayers/externs/esrijson.js", - "/opt/apiv3/node_modules/openlayers/externs/geojson.js", - "/opt/apiv3/node_modules/openlayers/externs/proj4js.js", - "/opt/apiv3/node_modules/openlayers/externs/tilejson.js", - "/opt/apiv3/node_modules/openlayers/externs/topojson.js", - "/opt/apiv3/node_modules/ngeo/options/ngeox.js", - "/opt/apiv3/node_modules/openlayers/externs/olx.js", - "/opt/apiv3/node_modules/openlayers/externs/oli.js", - "/opt/apiv3/node_modules/ngeo/externs/d3.js", - "/opt/apiv3/node_modules/ngeo/externs/twbootstrap.js", - "/opt/apiv3/node_modules/ngeo/externs/typeahead.js", - "/opt/apiv3/node_modules/ngeo/externs/mapfish-print-v3.js", - "/opt/apiv3/.build/externs/angular-1.6.js", - "/opt/apiv3/.build/externs/angular-1.6-q_templated.js", - "/opt/apiv3/.build/externs/angular-1.6-http-promise_templated.js", - "/opt/apiv3/jsapi/externs/fuse.js", - "/opt/apiv3/.build/externs/jquery-1.9.js", - "/opt/apiv3/jsapi/externs/autocompletex.js", - "/opt/apiv3/jsapi/externs/luxx.js" + "/etc/apiv3/node_modules/openlayers/externs/bingmaps.js", + "/etc/apiv3/node_modules/openlayers/externs/cartodb.js", + "/etc/apiv3/node_modules/openlayers/externs/closure-compiler.js", + "/etc/apiv3/node_modules/openlayers/externs/esrijson.js", + "/etc/apiv3/node_modules/openlayers/externs/geojson.js", + "/etc/apiv3/node_modules/openlayers/externs/proj4js.js", + "/etc/apiv3/node_modules/openlayers/externs/tilejson.js", + "/etc/apiv3/node_modules/openlayers/externs/topojson.js", + "/etc/apiv3/node_modules/ngeo/options/ngeox.js", + "/etc/apiv3/node_modules/openlayers/externs/olx.js", + "/etc/apiv3/node_modules/openlayers/externs/oli.js", + "/etc/apiv3/node_modules/ngeo/externs/d3.js", + "/etc/apiv3/node_modules/ngeo/externs/twbootstrap.js", + "/etc/apiv3/node_modules/ngeo/externs/typeahead.js", + "/etc/apiv3/node_modules/ngeo/externs/mapfish-print-v3.js", + "/etc/apiv3/.build/externs/angular-1.6.js", + "/etc/apiv3/.build/externs/angular-1.6-q_templated.js", + "/etc/apiv3/.build/externs/angular-1.6-http-promise_templated.js", + "/etc/apiv3/jsapi/externs/fuse.js", + "/etc/apiv3/.build/externs/jquery-1.9.js", + "/etc/apiv3/jsapi/externs/autocompletex.js", + "/etc/apiv3/jsapi/externs/luxx.js" ], "define": [ "goog.DEBUG=false", diff --git a/geoportal/jsapi/jsdoc/api/template/publish.js b/geoportal/jsapi/jsdoc/api/template/publish.js index d3912d5b2..d5d750c0e 100644 --- a/geoportal/jsapi/jsdoc/api/template/publish.js +++ b/geoportal/jsapi/jsdoc/api/template/publish.js @@ -10,7 +10,7 @@ var taffy = require('taffydb').taffy; var template = require('jsdoc/template'); var util = require('util'); var jsdocType = require("jsdoc/tag/type") -var jsdocOl3 = require('/opt/apiv3/.build/jsdocOl3.js'); +var jsdocOl3 = require('/etc/apiv3/.build/jsdocOl3.js'); var htmlsafe = helper.htmlsafe; var linkto = helper.linkto; diff --git a/geoportal/jsapi/less/geoportailv3.api.less b/geoportal/jsapi/less/geoportailv3.api.less index 8cd2cc2e3..4c8524c7d 100644 --- a/geoportal/jsapi/less/geoportailv3.api.less +++ b/geoportal/jsapi/less/geoportailv3.api.less @@ -1,7 +1,7 @@ -@import (inline) '/opt/apiv3/node_modules/mapbox-gl/dist/mapbox-gl.css'; -@import (inline) '/opt/apiv3/node_modules/openlayers/css/ol.css'; -@import (inline) '/opt/apiv3/node_modules/js-autocomplete/auto-complete.css'; -@import "/opt/apiv3/node_modules/bootstrap/less/mixins/vendor-prefixes.less"; +@import (inline) '/etc/apiv3/node_modules/mapbox-gl/dist/mapbox-gl.css'; +@import (inline) '/etc/apiv3/node_modules/openlayers/css/ol.css'; +@import (inline) '/etc/apiv3/node_modules/js-autocomplete/auto-complete.css'; +@import "/etc/apiv3/node_modules/bootstrap/less/mixins/vendor-prefixes.less"; @bg: #fff; @border: 1px solid #8394a0; diff --git a/geoportal/jsapi/rebuild_api.sh b/geoportal/jsapi/rebuild_api.sh index 66ebe878f..00d7b7e7e 100755 --- a/geoportal/jsapi/rebuild_api.sh +++ b/geoportal/jsapi/rebuild_api.sh @@ -12,7 +12,7 @@ cp node_modules/font-awesome/fonts/* /app/geoportailv3_geoportal/jsapi/webfonts/ cp /app/geoportailv3_geoportal/static-ngeo/webfonts/*.* /app/geoportailv3_geoportal/jsapi/build/fonts/ cp /app/geoportailv3_geoportal/static-ngeo/webfonts/*.* /app/geoportailv3_geoportal/jsapi/webfonts/ -node node_modules/openlayers/tasks/build.js /opt/apiv3/jsapi/config.json /etc/static-ngeo/build/apiv3.js +node node_modules/openlayers/tasks/build.js /etc/apiv3/jsapi/config.json /etc/static-ngeo/build/apiv3.js # The sourcemap is nonsensical, probably due to a GCC version way too old # so it is better to disable it # echo '//# sourceMappingURL=apiv3.js.map' >> /app/geoportailv3_geoportal/static-ngeo/build/apiv3.js @@ -28,22 +28,22 @@ node_modules/js-autocomplete/auto-complete.min.js \ node_modules/promise-polyfill/promise.min.js \ node_modules/url-polyfill/url-polyfill.min.js > /etc/static-ngeo/build/vendor.js -./node_modules/.bin/lessc --clean-css /opt/apiv3/jsapi/less/geoportailv3.api.less /etc/static-ngeo/build/apiv3.css -node /opt/apiv3/jsapi/jsdoc/get-ol3-doc-ref.js > /opt/apiv3/.build/jsdocOl3.js +./node_modules/.bin/lessc --clean-css /etc/apiv3/jsapi/less/geoportailv3.api.less /etc/static-ngeo/build/apiv3.css +node /etc/apiv3/jsapi/jsdoc/get-ol3-doc-ref.js > /etc/apiv3/.build/jsdocOl3.js node node_modules/.bin/jsdoc /opt/apiv3/jsapi/jsdoc/api/index.md -c /opt/apiv3/jsapi/jsdoc/api/conf.json -d /app/geoportailv3_geoportal/jsapi/build/apidoc cp -R /opt/apiv3/jsapi/examples /app/geoportailv3_geoportal/jsapi/build/apidoc/ -cp /opt/apiv3/node_modules/@camptocamp/closure-util/.deps/library/*/closure/goog/base.js /etc/static-ngeo/build/ -cp /opt/apiv3/node_modules/mapbox-gl/dist/mapbox-gl.js.map /etc/static-ngeo/build/ +cp /etc/apiv3/node_modules/@camptocamp/closure-util/.deps/library/*/closure/goog/base.js /etc/static-ngeo/build/ +cp /etc/apiv3/node_modules/mapbox-gl/dist/mapbox-gl.js.map /etc/static-ngeo/build/ cd /etc/static-ngeo/build/ -rm -f jsapi_node_modules; ln -s /opt/apiv3/node_modules jsapi_node_modules -rm -f jsapi_src; ln -s /opt/apiv3/jsapi/src/ jsapi_src -rm -f jsapi_closure; ln -s /opt/apiv3/jsapi/closure/ jsapi_closure +rm -f jsapi_node_modules; ln -s /etc/apiv3/node_modules jsapi_node_modules +rm -f jsapi_src; ln -s /etc/apiv3/jsapi/src/ jsapi_src +rm -f jsapi_closure; ln -s /etc/apiv3/jsapi/closure/ jsapi_closure -python3 /opt/apiv3/jsapi/closure/depswriter.py --root_with_prefix=". ../../.." \ +python3 /etc/apiv3/jsapi/closure/depswriter.py --root_with_prefix=". ../../.." \ --root_with_prefix="jsapi_node_modules/openlayers/src ./jsapi_node_modules/openlayers/src" \ --root_with_prefix="jsapi_src jsapi_src" \ --root_with_prefix="jsapi_closure jsapi_closure" \