diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..819b6775 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM nginx:alpine +COPY ./nginx/nginx.conf /etc/nginx/nginx.conf + +## Remove default nginx index page + +COPY ./dist /usr/share/nginx/html +ADD ./scripts/startup /sbin/startup +RUN chmod +x /sbin/startup + +EXPOSE 80 +ENTRYPOINT ["/sbin/startup"] diff --git a/nginx/nginx.conf b/nginx/nginx.conf new file mode 100644 index 00000000..a5893f7c --- /dev/null +++ b/nginx/nginx.conf @@ -0,0 +1,66 @@ +worker_processes 4; + +events { worker_connections 1024; } + +http { + server { + listen 8080; + root /usr/share/nginx/html; + include /etc/nginx/mime.types; + + expires 1d; + add_header X-Content-Type-Options nosniff; + add_header X-Frame-Options "SAMEORIGIN"; + add_header X-XSS-Protection "1; mode=block"; + add_header Referrer-Policy "no-referrer-when-downgrade"; + add_header Permissions-Policy "fullscreen=(self)"; + add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"; + add_header Content-Security-Policy "default-src 'self';"; + + gzip on; + gzip_types + application/atom+xml + application/geo+json + application/javascript + application/x-javascript + application/json + application/ld+json + application/manifest+json + application/rdf+xml + application/rss+xml + application/xhtml+xml + application/xml + font/eot + font/otf + font/ttf + image/svg+xml + text/css + text/javascript + text/plain + text/xml; + + location / { + index index.html index.php; + include mime.types; + add_header X-Content-Type-Options nosniff; + expires 1d; + add_header X-Frame-Options "SAMEORIGIN"; + add_header X-XSS-Protection "1; mode=block"; + add_header Referrer-Policy "no-referrer-when-downgrade"; + add_header Permissions-Policy "fullscreen=(self)"; + add_header Cache-Control "must-revalidate, no-cache, no-store"; + add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"; + add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline' https://api.mapbox.com/ ; worker-src blob:; img-src 'self' data: blob:; child-src blob:; connect-src 'self' https://basemaps.cartocdn.com https://*.basemaps.cartocdn.com https://*.mapbox.com https://login.microsoftonline.com"; + gzip on; + gzip_types text/plain application/json application/javascript text/css; + gzip_min_length 1000; + + try_files $uri $uri/ /index.html =404; + } + + location /index.html { + add_header Cache-Control 'no-store'; + } + + } +} diff --git a/package-lock.json b/package-lock.json index 66d533c5..a8de0660 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,8 +9,8 @@ "version": "1.0.1", "dependencies": { "@deltares/fews-pi-requests": "^1.0.2", - "@deltares/fews-ssd-requests": "^1.0.0", - "@deltares/fews-ssd-webcomponent": "^1.0.0", + "@deltares/fews-ssd-requests": "^1.0.1", + "@deltares/fews-ssd-webcomponent": "^1.0.1", "@deltares/fews-web-oc-charts": "^3.0.0", "@deltares/fews-wms-requests": "^1.0.0", "@studiometa/vue-mapbox-gl": "^2.2.0", @@ -58,6 +58,53 @@ "vue-tsc": "^1.8.22" } }, + "../fews/fews-ssd-requests": { + "name": "root", + "version": "0.2.6", + "devDependencies": { + "lerna": "^5.0.0" + } + }, + "../fews/fews-ssd-requests/fews-ssd-requests": { + "extraneous": true + }, + "../fews/fews-ssd-requests/packages/fews-ssd-requests": { + "name": "@deltares/fews-ssd-requests", + "version": "1.0.1", + "license": "MIT", + "dependencies": { + "@deltares/fews-web-oc-utils": "^1.0.0" + }, + "devDependencies": { + "@deltares/fews-pi-requests": "^1.0.2", + "@types/jest": "27.0.0", + "@types/jsdom": "^16.2.14", + "@typescript-eslint/eslint-plugin": "^2.18.0", + "@typescript-eslint/parser": "^2.18.0", + "cross-fetch": "^3.1.5", + "dotenv": "^16.0.0", + "eslint": "^6.8.0", + "jest": "27.3.1", + "jest-environment-jsdom": "27.3.1", + "jest-junit": "^13.0.0", + "jest-teamcity-reporter": "^0.9.0", + "jsdom": "^19.0.0", + "json-schema-to-typescript": "^11.0.2", + "shx": "^0.3.2", + "sonarqube-scanner": "^3.0.1", + "ts-jest": "27.0.0", + "typedoc": "^0.22.6", + "typescript": "^4.4.0", + "webpack": "^5.59.0", + "webpack-cli": "^4.9.1" + }, + "engines": { + "node": ">=0.14" + } + }, + "../fews/fews-ssd-requestspackages/fews-ssd-requests": { + "extraneous": true + }, "node_modules/@aashutoshrathi/word-wrap": { "version": "1.2.6", "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", @@ -279,22 +326,15 @@ } }, "node_modules/@deltares/fews-ssd-requests": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@deltares/fews-ssd-requests/-/fews-ssd-requests-1.0.0.tgz", - "integrity": "sha512-tS8XJT1eRqIlIQabV3pQ9zZegdNK+g6NG2Ia5C4S+IvUrHUZWb8TtqhFJlWu/NjlJPYC0iZED5eDNaZ9DObHgw==", - "dependencies": { - "@deltares/fews-web-oc-utils": "^1.0.0" - }, - "engines": { - "node": ">=0.14" - } + "resolved": "../fews/fews-ssd-requests/packages/fews-ssd-requests", + "link": true }, "node_modules/@deltares/fews-ssd-webcomponent": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@deltares/fews-ssd-webcomponent/-/fews-ssd-webcomponent-1.0.0.tgz", - "integrity": "sha512-Jwqf/z7u3zOFvTzaGY/BoblleOuAAQVm6wwoH/H8534Z1ym65ypM1I5pUxs53cIoV5ckOfUxiEulmHGwvbMQbg==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@deltares/fews-ssd-webcomponent/-/fews-ssd-webcomponent-1.0.1.tgz", + "integrity": "sha512-/1OWfCegJZ2BObCwaADZweQPDimJ4SQs/GyzpymWVKQ56F6zv/WVDgLEBgIOi0qJ67KHrvAHKzCIxummgz8lqg==", "dependencies": { - "@deltares/fews-ssd-requests": "^1.0.0", + "@deltares/fews-ssd-requests": "^1.0.1", "@stencil/core": "^2.17.4" } }, diff --git a/package.json b/package.json index 20426735..994fe066 100644 --- a/package.json +++ b/package.json @@ -17,8 +17,8 @@ }, "dependencies": { "@deltares/fews-pi-requests": "^1.0.2", - "@deltares/fews-ssd-requests": "^1.0.0", - "@deltares/fews-ssd-webcomponent": "^1.0.0", + "@deltares/fews-ssd-requests": "^1.0.1", + "@deltares/fews-ssd-webcomponent": "^1.0.1", "@deltares/fews-web-oc-charts": "^3.0.0", "@deltares/fews-wms-requests": "^1.0.0", "@studiometa/vue-mapbox-gl": "^2.2.0", diff --git a/scripts/.gitattributes b/scripts/.gitattributes new file mode 100644 index 00000000..cc9532c8 --- /dev/null +++ b/scripts/.gitattributes @@ -0,0 +1 @@ +startup text eol=lf \ No newline at end of file diff --git a/scripts/startup b/scripts/startup new file mode 100644 index 00000000..db2a75a5 --- /dev/null +++ b/scripts/startup @@ -0,0 +1,15 @@ +#!/bin/sh +if [ -z "${BASE_URL}" ] +then + BASE_URL="/" + echo "No BASE_URL specified using default '${BASE_URL}';" +fi + +PUBLIC_ROOT="/usr/share/nginx/html" + +# Changes for BASE URL +sed -i "s@/__BASE_URL__@${BASE_URL}@g" ${PUBLIC_ROOT}/assets/index-*.js +sed -i "s@/__BASE_URL__@${BASE_URL}@g" ${PUBLIC_ROOT}/assets/index-*.css +sed -i "s@/__BASE_URL__@${BASE_URL}@g" ${PUBLIC_ROOT}/index.html + +exec nginx -g 'daemon off;' \ No newline at end of file