Browse Source

Merge pull request #91 from rlex/new_dockerfile

New dockerfile
Aykut Saraç 2 years ago
parent
commit
33c3e74b49
3 changed files with 14 additions and 12 deletions
  1. 4 11
      Dockerfile
  2. 1 1
      README.md
  3. 9 0
      default.conf

+ 4 - 11
Dockerfile

@@ -1,18 +1,11 @@
 # Builder
 # Builder
 FROM node:14-buster as builder
 FROM node:14-buster as builder
-
 WORKDIR /src
 WORKDIR /src
-
 COPY . /src
 COPY . /src
-
-RUN npm install --legacy-peer-deps
-
-RUN npm run build
+RUN yarn install --legacy-peer-deps
+RUN yarn run build
 
 
 # App
 # App
-FROM nginx:alpine
-
+FROM nginxinc/nginx-unprivileged
 COPY --from=builder /src/out /app
 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

+ 1 - 1
README.md

@@ -60,7 +60,7 @@ A Docker file is provided in the root of the repository.
 If you want to run JSON Visio locally:
 If you want to run JSON Visio locally:
   
   
 * Build Docker image with `docker build -t jsonvisio .`
 * Build Docker image with `docker build -t jsonvisio .`
-* Run locally with `docker run -p 8888:80 jsonvisio`
+* Run locally with `docker run -p 8888:8080 jsonvisio`
 * Go to [http://localhost:8888]
 * Go to [http://localhost:8888]
 ```
 ```
 
 

+ 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;
+    }
+}