-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
server docusaurus static files with nginx
add security headers fix docker compose
- Loading branch information
1 parent
47c0bc6
commit e1691d5
Showing
10 changed files
with
104 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
FROM docker.io/node:20.14.0-alpine3.20 as builder | ||
FROM docker.io/node:20.14.0-alpine3.20 AS builder | ||
|
||
WORKDIR /site | ||
COPY . . | ||
RUN npm install | ||
RUN npm run build | ||
|
||
FROM docker.io/nginxinc/nginx-unprivileged:1.26.2-alpine | ||
WORKDIR /site | ||
COPY --from=builder /site/build /site | ||
COPY /proxy/server.conf /etc/nginx/conf.d/default.conf | ||
COPY /proxy/securityheaders /etc/nginx/conf.d/ | ||
EXPOSE 8080 | ||
USER 1000 | ||
CMD ["npm", "run", "serve"] | ||
USER 101 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
add_header X-Frame-Options deny always; | ||
add_header X-Content-Type-Options nosniff always; | ||
add_header X-Permitted-Cross-Domain-Policies none always; | ||
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-eval' 'unsafe-inline'; object-src 'none'; img-src 'self' data:; style-src 'self' 'unsafe-inline' https://cdn.eds.equinor.com/font/; font-src 'self' https://cdn.eds.equinor.com/font/; frame-ancestors 'none'; upgrade-insecure-requests; block-all-mixed-content" always; | ||
add_header Cross-Origin-Resource-Policy same-origin always; | ||
add_header Permissions-Policy "camera=(),display-capture=(),fullscreen=(),geolocation=(),microphone=()" always; | ||
add_header Referrer-Policy no-referrer always; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
server { | ||
listen 8080; | ||
absolute_redirect off; | ||
root /site; | ||
|
||
server_tokens off; | ||
|
||
include /etc/nginx/conf.d/securityheaders; | ||
|
||
location / { | ||
index index.html | ||
try_files $uri $uri/ =404; | ||
} | ||
|
||
error_page 404 /404.html; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
server { | ||
listen 8080; | ||
absolute_redirect off; | ||
# root /site; | ||
|
||
server_tokens off; | ||
|
||
include /etc/nginx/conf.d/securityheaders; | ||
|
||
location / { | ||
proxy_pass http://docusaurus:8000/; | ||
|
||
proxy_read_timeout 3600s; | ||
proxy_send_timeout 3600s; | ||
|
||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection $http_connection; | ||
} | ||
|
||
# error_page 404 /404.html; | ||
} |