mirror of
https://github.com/consbio/mbtileserver.git
synced 2024-09-11 07:15:24 +03:00
Updated docker build process and added instructions
This commit is contained in:
parent
c5ec1da52d
commit
4d1cdc7e8f
3
.dockerignore
Normal file
3
.dockerignore
Normal file
@ -0,0 +1,3 @@
|
||||
**/.git
|
||||
**/node_modules
|
||||
mbtiles/testdata/*
|
24
Dockerfile
24
Dockerfile
@ -1,16 +1,24 @@
|
||||
FROM golang:1.12.7-stretch
|
||||
# Stage 1: compile mbtileserver
|
||||
FROM golang:1.12.9-alpine
|
||||
|
||||
WORKDIR /
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
RUN apk add git build-base
|
||||
COPY . .
|
||||
|
||||
RUN GOOS=linux GO111MODULE=on go build -o /mbtileserver
|
||||
|
||||
|
||||
# Stage 2: start from a smaller image
|
||||
FROM alpine:3.10.1
|
||||
RUN mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2
|
||||
COPY --from=0 /mbtileserver /mbtileserver
|
||||
|
||||
WORKDIR /
|
||||
CMD ["/mbtileserver"]
|
||||
|
||||
# Link libs to get around issues using musl
|
||||
RUN mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2
|
||||
|
||||
# copy the executable to the emptry container
|
||||
COPY --from=0 /mbtileserver /mbtileserver
|
||||
|
||||
# Set the command as the entrypoint, so that it captures any
|
||||
# command-line arguments passed in
|
||||
ENTRYPOINT ["/mbtileserver"]
|
29
README.md
29
README.md
@ -132,6 +132,35 @@ $ kill -HUP <pid>
|
||||
Reloading the server will cause it to pick up changes to the tiles directory, adding new tilesets and removing any that
|
||||
are no longer present.
|
||||
|
||||
## Docker
|
||||
|
||||
Pull the latest image from [Docker Hub](https://hub.docker.com/r/consbio/mbtileserver):
|
||||
|
||||
```
|
||||
docker pull consbio/mbtileserver:latest
|
||||
```
|
||||
|
||||
To build the Docker image locally (named `mbtileserver`):
|
||||
|
||||
```
|
||||
docker build -t mbtileserver -f Dockerfile .
|
||||
```
|
||||
|
||||
To run the Docker container on port 8080 with your tilesets in `<host tile dir>`.
|
||||
Note that by default, `mbtileserver` runs on port 8000 in the container.
|
||||
|
||||
```
|
||||
docker run --rm -p 8080:8000 -v <host tile dir>:/tilesets -t mbtileserver
|
||||
```
|
||||
|
||||
You can pass in additional command-line arguments to `mbtilesever`, for example, to use
|
||||
certificates and files in `<host cert dir>` so that you can access the server via HTTPS. The example below uses self-signed certificates generated using
|
||||
[`mkcert`](https://github.com/FiloSottile/mkcert). This example uses automatic redirects, which causes `mbtileserver` to also listen on port 80 and automatically redirect to 443.
|
||||
|
||||
```
|
||||
docker run --rm -p 80:80 443:443 -v <host tile dir>:/tilesets -v <host cert dir>:/certs/ -t mbtileserver -c /certs/localhost.pem -k /certs/localhost-key.pem -p 443 --redirect
|
||||
```
|
||||
|
||||
## Specifications
|
||||
|
||||
- expects mbtiles files to follow version 1.0 of the [mbtiles specification](https://github.com/mapbox/mbtiles-spec). Version 1.1 is preferred.
|
||||
|
Loading…
Reference in New Issue
Block a user