Browse Source

dockerfile improvement

Lex Rivera 2 years ago
parent
commit
5eebab6f7f
2 changed files with 13 additions and 11 deletions
  1. 4 11
      Dockerfile
  2. 9 0
      default.conf

+ 4 - 11
Dockerfile

@@ -1,18 +1,11 @@
 # Builder
 FROM node:14-buster as builder
-
 WORKDIR /src
-
 COPY . /src
-
-RUN npm install --legacy-peer-deps
-
-RUN npm run build
+RUN yarn install --legacy-peer-deps
+RUN yarn run build
 
 # App
-FROM nginx:alpine
-
+FROM nginxinc/nginx-unprivileged
 COPY --from=builder /src/out /app
-
-RUN rm -rf /usr/share/nginx/html \
-  && ln -s /app /usr/share/nginx/html
+COPY default.conf /etc/nginx/conf.d/default.conf

+ 9 - 0
default.conf

@@ -0,0 +1,9 @@
+server {
+    listen 8080;
+    root  /app;
+    include /etc/nginx/mime.types;
+
+    location /editor {
+        try_files $uri /editor.html;
+    }
+}