diff --git a/Dockerfile b/Dockerfile index c08154a..943ed40 100644 --- a/Dockerfile +++ b/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 diff --git a/README.md b/README.md index 7ffa75a..9a0cf70 100644 --- a/README.md +++ b/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: * 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] ``` diff --git a/default.conf b/default.conf new file mode 100644 index 0000000..c97e205 --- /dev/null +++ b/default.conf @@ -0,0 +1,9 @@ +server { + listen 8080; + root /app; + include /etc/nginx/mime.types; + + location /editor { + try_files $uri /editor.html; + } +}