Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

647 add scripts for docker #686

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
66 changes: 66 additions & 0 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -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';
}

}
}
70 changes: 55 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions scripts/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
startup text eol=lf
15 changes: 15 additions & 0 deletions scripts/startup
Original file line number Diff line number Diff line change
@@ -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;'
Loading