Skip to content

Commit f45c7e4

Browse files
committed
updated vars config
1 parent c408cea commit f45c7e4

File tree

4 files changed

+63
-7
lines changed

4 files changed

+63
-7
lines changed

Diff for: Dockerfile

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
FROM nginx:1.10.1-alpine
22

3-
ADD ./preconfigure.sh /preconfigure.sh
3+
ADD ./config.sh /config.sh
44
COPY ./autosize.js /usr/share/nginx/html
5+
COPY ./vars.sh /vars.sh
56

6-
#Documentation
7-
#EXPOSE 80
87

9-
RUN chmod +x ./preconfigure.sh
10-
CMD ./preconfigure.sh
8+
RUN chmod +x /config.sh
9+
CMD /config.sh

Diff for: config.sh

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#/bin/bash
2+
3+
#retrieve variables from vars.sh
4+
source ./vars.sh
5+
6+
set -e
7+
8+
echo "using Tile Server: $TILESERVER"
9+
echo "attribution: $ATTRIBUTION"
10+
11+
cat <<HERE >/usr/share/nginx/html/index.html
12+
<!DOCTYPE html>
13+
<html>
14+
<head>
15+
<title>${TITLE}</title>
16+
<meta charset="utf-8" />
17+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
18+
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.css" />
19+
<style>
20+
body {
21+
padding: 0px;
22+
margin: 0px;
23+
height: 100%;
24+
width: 100%;
25+
}
26+
#map {
27+
width: 100%;
28+
height: 100%;
29+
}
30+
</style>
31+
</head>
32+
<body>
33+
<div id="map"></div>
34+
<script src="//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js"></script>
35+
<script src="//cdnjs.cloudflare.com/ajax/libs/zepto/1.1.4/zepto.min.js"></script>
36+
<script src="autosize.js"></script>
37+
<script>
38+
Autosize.enable();
39+
var map = L.map('map').setView([${DEFAULT_LAT}, ${DEFAULT_LON}], ${DEFAULT_SCALE});
40+
L.tileLayer('${TILESERVER}', {
41+
attribution: '${ATTRIBUTION}'
42+
})
43+
.addTo(map);
44+
</script>
45+
</body>
46+
</html>
47+
HERE
48+
49+
nginx -g "daemon off;"

Diff for: docker-compose.yaml

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
version: '3.3'
22
services:
33
nginx-leafletjs:
4+
container_name: leaflet
5+
image: nginx-leafletjs:latest
6+
restart: always
47
ports:
58
- '8777:80'
6-
image: freecandy/nginx-leafletjs
7-
restart: always

Diff for: vars.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
TITLE="Docker Leaflet"
2+
DEFAULT_LAT="34.54"
3+
DEFAULT_LON="-112.47"
4+
DEFAULT_SCALE="14"
5+
6+
TILESERVER="http://{s}.tile.osm.org/{z}/{x}/{y}.png"
7+
ATTRIBUTION="&copy; <a href=\"http://osm.org/copyright\">OpenStreetMap</a> contributors"

0 commit comments

Comments
 (0)