mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-12-25 18:48:37 +01:00
Optimize docker image
* Use 2 stage docker building to produce a tiny python3-slim based docker image with just the compilation results.
This commit is contained in:
parent
109198a524
commit
de9c4fcc4a
4 changed files with 73 additions and 17 deletions
45
.dockerignore
Normal file
45
.dockerignore
Normal file
|
@ -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
|
35
Dockerfile
35
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
|
||||
|
|
|
@ -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 <https://maputnik.github.io/donate>
|
||||
|
||||
## 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
|
||||
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
"url": "https://github.com/maputnik/editor"
|
||||
},
|
||||
"author": "Lukas Martinelli",
|
||||
"contributors": [
|
||||
"Yuri Astrakhan <YuriAstrakhan@gmail.com>"
|
||||
],
|
||||
"license": "MIT",
|
||||
"homepage": "https://github.com/maputnik/editor#readme",
|
||||
"dependencies": {
|
||||
|
|
Loading…
Reference in a new issue