From de9c4fcc4a157e283dafa127f6bd443a985173eb Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Sat, 3 Aug 2019 12:03:16 -0400 Subject: [PATCH 1/3] Optimize docker image * Use 2 stage docker building to produce a tiny python3-slim based docker image with just the compilation results. --- .dockerignore | 45 +++++++++++++++++++++++++++++++++++++++++++++ Dockerfile | 35 ++++++++++++++++++----------------- README.md | 7 +++++++ package.json | 3 +++ 4 files changed, 73 insertions(+), 17 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..0338ac2 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,45 @@ +.git +.gitignore +Dockerfile + +# +# +# COPIED FROM .gitignore , please keep it in sync +# +# + +# Logs +logs +*.log +*.swp +*.swo + +# Runtime data +pids +*.pid +*.seed + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directory +# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git +node_modules + +# Ignore build files +public +/errorShots +/old +/build diff --git a/Dockerfile b/Dockerfile index a6279cc..2e71e6c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,21 +1,22 @@ -FROM node:10-slim +FROM node:10 as builder +WORKDIR /maputnik -RUN apt-get update && apt-get install -y --no-install-recommends \ - git \ - python \ - && rm -rf /var/lib/apt/lists/* +# Only copy package.json to prevent npm install from running on every build +COPY package.json package-lock.json ./ +RUN npm install -EXPOSE 8888 - -ENV HOME /maputnik -RUN mkdir ${HOME} - -COPY . ${HOME}/ - -WORKDIR ${HOME} - -RUN npm install -d +# Build maputnik +# TODO: we should also do a npm run test here (needs more dependencies) +COPY . . RUN npm run build -WORKDIR ${HOME}/build/build -CMD python -m SimpleHTTPServer 8888 +#--------------------------------------------------------------------------- + +# Create a clean python-based image with just the build results +FROM python:3-slim +WORKDIR /maputnik + +COPY --from=builder /maputnik/build/build . + +EXPOSE 8888 +CMD python -m http.server 8888 diff --git a/README.md b/README.md index b81fc82..7053358 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,13 @@ Mapbox has built one of the best and most amazing OSS ecosystems. A key componen ## Donations If you or your organisation has seen value from Maputnik, please consider donating at +## Using + +The quickest way is to use docker, even without cloning the repo. Run this command and open your browser to http://localhost:8888 . Ctrl+C to stop the server. + +```bash +docker run -it -p 8888:8888 maputnik +``` ## Documentation diff --git a/package.json b/package.json index 170761c..e38ac40 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,9 @@ "url": "https://github.com/maputnik/editor" }, "author": "Lukas Martinelli", + "contributors": [ + "Yuri Astrakhan " + ], "license": "MIT", "homepage": "https://github.com/maputnik/editor#readme", "dependencies": { From 608b836fe0f7f05c80dd53118aa7db4295310a13 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Sat, 3 Aug 2019 12:36:01 -0400 Subject: [PATCH 2/3] fix readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7053358..5de3f99 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ If you or your organisation has seen value from Maputnik, please consider donati The quickest way is to use docker, even without cloning the repo. Run this command and open your browser to http://localhost:8888 . Ctrl+C to stop the server. ```bash -docker run -it -p 8888:8888 maputnik +docker run -it --rm -p 8888:8888 maputnik/editor ``` ## Documentation From 2a832955c4885b80e9009c061bc0b48f3d5e4a50 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Sat, 3 Aug 2019 15:02:16 -0400 Subject: [PATCH 3/3] Updated docs, rm creds --- README.md | 17 +++++++---------- package.json | 3 --- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 5de3f99..99ee752 100644 --- a/README.md +++ b/README.md @@ -17,23 +17,20 @@ A free and open visual editor for the [Mapbox GL styles](https://www.mapbox.com/mapbox-gl-style-spec/) targeted at developers and map designers. +## Usage + - :link: Design your maps online at **** (all in local storage) - :link: Use the [Maputnik CLI](https://github.com/maputnik/editor/wiki/Maputnik-CLI) for local style development - -Mapbox has built one of the best and most amazing OSS ecosystems. A key component to ensure its longevity and independence is an OSS map designer. - - -## Donations -If you or your organisation has seen value from Maputnik, please consider donating at - -## Using - -The quickest way is to use docker, even without cloning the repo. Run this command and open your browser to http://localhost:8888 . Ctrl+C to stop the server. +- In a Docker, run this command and browse to http://localhost:8888, Ctrl+C to stop the server. ```bash docker run -it --rm -p 8888:8888 maputnik/editor ``` +## Donations +Mapbox has built one of the best and most amazing OSS ecosystems. A key component to ensure its longevity and independence is an OSS map designer. +If you or your organisation has seen value from Maputnik, please consider donating at + ## Documentation The documentation can be found in the [Wiki](https://github.com/maputnik/editor/wiki). You are welcome to collaborate! diff --git a/package.json b/package.json index e38ac40..170761c 100644 --- a/package.json +++ b/package.json @@ -17,9 +17,6 @@ "url": "https://github.com/maputnik/editor" }, "author": "Lukas Martinelli", - "contributors": [ - "Yuri Astrakhan " - ], "license": "MIT", "homepage": "https://github.com/maputnik/editor#readme", "dependencies": {