diff --git a/.Dockerignore b/.Dockerignore new file mode 100644 index 0000000..d5f19d8 --- /dev/null +++ b/.Dockerignore @@ -0,0 +1,2 @@ +node_modules +package-lock.json diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f94b6ba --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM node:18 as builder +ADD . /src +WORKDIR /src +RUN npm install && \ + npm run build + +FROM nginx:1.23 +COPY --from=builder /src/dist /usr/share/nginx/html +# Add text/cache-manifest type in mime types +RUN sed -i 's/^types {/types {\n text\/cache-manifest appcache;/' /etc/nginx/mime.types diff --git a/README.md b/README.md index a7dfac0..63258b6 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,10 @@ The latest stable build is hosted [here](https://www.mindmaps.app). * Run `npm run start` to launch a local dev server. The app will be hosted at [http://localhost:3000](http://localhost:3000). * Run `npm run build` to compile the production bundle. The artifacts will be located in `/dist`. +## Build docker image +* Run `docker build -t mindmaps:latest .` to build the image. +* You can run `docker run --name mindmaps -p 8080:80 mindmaps:latest` and your container is +reachable at [http://localhost:8080](http://localhost:8080) ## Host yourself All you need is a web server for static files. After building, copy all files from /dist into your web directory and launch the app with index.html.