Skip to content

Commit 950aa24

Browse files
authored
feat: testing unpriviledged nginx (#110)
1 parent bf145e3 commit 950aa24

File tree

3 files changed

+14
-17
lines changed

3 files changed

+14
-17
lines changed

Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ COPY /frontend ./
99
RUN npm run build-prod
1010
RUN npm run build:wc
1111

12-
FROM nginx:alpine
12+
FROM nginxinc/nginx-unprivileged:alpine
13+
USER 101
14+
15+
1316
COPY --from=build /app/frontend/dist/ /usr/share/nginx/html/ui/example-content/ui/
1417
COPY --from=build /app/frontend/dist-wc/ /usr/share/nginx/html/ui/example-content/wc/
15-
COPY nginx.conf /etc/nginx/nginx.conf
18+
COPY nginx.conf /etc/nginx/conf.d/default.conf
19+
1620
EXPOSE 8080

frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"scripts": {
55
"ng": "ng",
66
"start": "ng serve ui",
7-
"start:wc": "ng serve wc --single-bundle --no-live-reload --port=4201",
7+
"start:wc": "ng serve wc --single-bundle --no-live-reload --port=4201 --serve-path=/ui/example-ui/wc/ ",
88
"build": "ng build ui",
99
"build:wc": "ng build wc --single-bundle --output-hashing none",
1010
"build-prod": "ng build ui -c production",

nginx.conf

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
1-
# the events block is required
2-
events{}
3-
4-
http {
5-
# include the default mime.types to map file extensions to MIME types
1+
server {
62
include /etc/nginx/mime.types;
3+
add_header Access-Control-Allow-Origin *;
74

8-
server {
9-
add_header Access-Control-Allow-Origin *;
10-
11-
listen 8080;
5+
listen 8080;
126

13-
root /usr/share/nginx/html;
7+
root /usr/share/nginx/html;
148

15-
location /ui/example-content/ui/ {
16-
try_files $uri $uri/ /ui/example-content/ui/index.html =404;
17-
}
9+
location /ui/example-content/ui/ {
10+
try_files $uri $uri/ /ui/example-content/ui/index.html =404;
1811
}
19-
}
12+
}

0 commit comments

Comments
 (0)