File tree Expand file tree Collapse file tree 8 files changed +148
-0
lines changed Expand file tree Collapse file tree 8 files changed +148
-0
lines changed Original file line number Diff line number Diff line change
1
+ FROM node:20-alpine AS builder
2
+
3
+ WORKDIR /builder
4
+
5
+ COPY .yarn/releases .yarn/releases
6
+ COPY src src
7
+ COPY .yarnrc.yml .yarnrc.yml
8
+ COPY package.json package.json
9
+ COPY settings.json settings.json
10
+ COPY vite.config.ts vite.config.ts
11
+ COPY yarn.lock yarn.lock
12
+
13
+ RUN yarn install --immutable
14
+ RUN yarn build
15
+
16
+ # #######################################################################################################################
17
+
18
+ FROM nginx:1.25.4-alpine
19
+
20
+ RUN apk add --no-cache --upgrade \
21
+ # - stop vulnerabilities:package HIGH Vulnerability found in os package type (APKG) - libexpat (fixed in: 2.6.0-r0)(CVE-2023-52425 - https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-52425)
22
+ libexpat=2.6.2-r0 \
23
+ # - stop vulnerabilities:package HIGH Vulnerability found in os package type (APKG) - libxml2 (fixed in: 2.11.7-r0)(CVE-2024-25062 - https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-25062)
24
+ libxml2=2.11.7-r0
25
+
26
+ LABEL name="mia_template_service_name_placeholder" \
27
+ description="%CUSTOM_PLUGIN_SERVICE_DESCRIPTION%" \
28
+ eu.mia-platform.url="https://www.mia-platform.eu" \
29
+ eu.mia-platform.version="0.0.1"
30
+
31
+ COPY nginx /etc/nginx
32
+
33
+ RUN touch ./off \
34
+ && chmod o+rw ./off \
35
+ && echo "mia_template_service_name_placeholder: $COMMIT_SHA" >> /etc/nginx/commit.sha
36
+
37
+ WORKDIR /usr/static
38
+
39
+ COPY LICENSE LICENSE
40
+ COPY --from=builder /builder/dist ./
41
+
42
+ USER nginx
Original file line number Diff line number Diff line change
1
+ location / {
2
+ include /etc/nginx/security.d/cross-site_script.conf;
3
+ add_header 'Content-Security-Policy' "default-src 'self'; script-src 'self' 'unsafe-eval'; object-src 'none'; style-src 'self' 'unsafe-inline'; img-src 'self'; font-src 'self'" always;
4
+
5
+ expires $expires;
6
+
7
+ try_files $uri $uri/index.html /index.html =404;
8
+ }
Original file line number Diff line number Diff line change
1
+ open_file_cache max=5000 inactive=20s;
2
+ open_file_cache_valid 60s;
3
+ open_file_cache_min_uses 2;
4
+ open_file_cache_errors on;
Original file line number Diff line number Diff line change
1
+ worker_processes 2 ;
2
+
3
+ error_log /var/log/nginx/error.log warn ;
4
+
5
+ pid /tmp/nginx.pid;
6
+
7
+ events {
8
+ worker_connections 4096 ;
9
+ }
10
+
11
+ http {
12
+
13
+ client_body_temp_path /tmp/client_temp;
14
+ proxy_temp_path /tmp/proxy_temp_path;
15
+ fastcgi_temp_path /tmp/fastcgi_temp;
16
+ uwsgi_temp_path /tmp/uwsgi_temp;
17
+ scgi_temp_path /tmp/scgi_temp;
18
+
19
+ log_format x_real_ip '$remote_addr $original_request_host [$time_iso8601 ] "$request " $status $bytes_sent '
20
+ '"$http_referer " "$http_user_agent " - $request_time - $original_request_id ' ;
21
+
22
+ include /etc/nginx/variables.conf;
23
+ access_log /var/log/nginx/access.log x_real_ip buffer=32k flush=5m if=$loggable ;
24
+
25
+ server_tokens off ;
26
+ tcp_nopush on ;
27
+ tcp_nodelay on ;
28
+ sendfile on ;
29
+
30
+ include /etc/nginx/mime.types;
31
+ include /etc/nginx/filehandle_cache.conf;
32
+ include /etc/nginx/real_ip.conf;
33
+
34
+ server {
35
+ listen 8080 default_server ;
36
+ listen [::]:8080 default_server ;
37
+
38
+ root /usr/static;
39
+ include /etc/nginx/conf.d/website.conf;
40
+ }
41
+ }
Original file line number Diff line number Diff line change
1
+ set_real_ip_from 127.0.0.1; # trust localhost
2
+ set_real_ip_from unix:; # trust local unix socket
3
+ set_real_ip_from 10.0.0.0/8; # trust class A private networks
4
+ set_real_ip_from 172.16.0.0/12; # trust class B private networks
5
+ set_real_ip_from 192.168.0.0/16; # trust class C private networks
6
+
7
+ real_ip_header X-Forwarded-For;
8
+ real_ip_recursive on;
Original file line number Diff line number Diff line change
1
+ # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-XSS-Protection
2
+ add_header 'X-XSS-Protection' "1; mode=block" always;
Original file line number Diff line number Diff line change
1
+ # https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
2
+ add_header 'Content-Security-Policy' "default-src 'self'" always;
Original file line number Diff line number Diff line change
1
+ map $remote_addr $ip_loggable {
2
+ default 1;
3
+ "127.0.0.1" 0;
4
+ }
5
+
6
+ map $http_user_agent $agent_loggable {
7
+ default 1;
8
+ "~^kube-probe" 0;
9
+ }
10
+
11
+ map $ip_loggable-$agent_loggable $loggable {
12
+ default 0;
13
+ "1-1" 1;
14
+ }
15
+
16
+ # Get the request id from the upstream if exists or generate a new one
17
+ map $http_x_request_id $original_request_id {
18
+ default $http_x_request_id;
19
+ '' $request_id;
20
+ }
21
+
22
+ # Get the best host name possible from the upstream or client headers
23
+ map $http_x_forwarded_host $original_request_host {
24
+ default $http_x_forwarded_host;
25
+ '' $host;
26
+ }
27
+
28
+ # Get the original request scheme
29
+ map $http_x_forwarded_proto $original_request_scheme {
30
+ default $http_x_forwarded_proto;
31
+ '' $scheme;
32
+ }
33
+
34
+ map $sent_http_content_type $expires {
35
+ default off;
36
+ "~text/html" epoch;
37
+ "~text/css" max;
38
+ "~application/javascript" max;
39
+ "~image/" max;
40
+ "~font/" max;
41
+ }
You can’t perform that action at this time.
0 commit comments