Skip to content

Commit

Permalink
Merge pull request #4 from digitalearthpacific/add-docker-stuff
Browse files Browse the repository at this point in the history
Add test configuration and docker compose plus github action
  • Loading branch information
alexgleith authored Jul 30, 2024
2 parents e15e93b + f2a974b commit a71cb6c
Show file tree
Hide file tree
Showing 8 changed files with 270 additions and 27 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/build-test-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name : Push Docker Image

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

on:
pull_request:
push:
branches:
- main
release:
types:
- created

jobs:
# Todo: Set up smoke test
# test:
# runs-on: ubuntu-latest
# steps:

push:
permissions: write-all
if: github.ref == 'refs/heads/main' || github.event_name == 'release'
# needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Get version number for tagging the image
id: get_version
run: |
git fetch --all --tags
echo "VERSION=$(git describe --tags)" >> $GITHUB_OUTPUT
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.get_version.outputs.VERSION }},${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
data
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM maptiler/tileserver-gl

ADD config.json styles.json /data/
19 changes: 19 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
data/coastlines_0-7-0-54.gpkg:
wget https://deppcpublicstorage.blob.core.windows.net/output/dep_ls_coastlines/dep_ls_coastlines_0-7-0-54.gpkg \
-O data/dep_ls_coastlines_0-7-0-54.gpkg

data/coastlines_0-7-0-54.pmtiles:
wget https://deppcpublicstorage.blob.core.windows.net/output/dep_ls_coastlines/dep_ls_coastlines_0-7-0-54.pmtiles \
-O data/dep_ls_coastlines_0-7-0-54.pmtiles

download:
make data/coastlines_0-7-0-54.gpkg
make data/coastlines_0-7-0-54.pmtiles

upload:
aws s3 sync \
data/ \
s3://dep-public-prod/dep_ls_coastlines/ \

up:
docker-compose up
35 changes: 31 additions & 4 deletions config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,33 @@
{
"paths": {
"glyphs": "https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf"
"options": {
"domains": [
"prod.digitalearthpacific.org",
"localhost:8080",
"127.0.0.1:8080"
],
"formatQuality": {
"jpeg": 80,
"webp": 90
},
"maxScaleFactor": 3,
"maxSize": 2048,
"pbfAlias": "pbf",
"serveAllFonts": false,
"serveAllStyles": false,
"serveStaticMaps": true,
"allowRemoteMarkerIcons": true,
"allowInlineMarkerImages": true,
"staticAttributionText": "© Digital Earth Pacific",
"tileMargin": 0
},
"styles": { "coastlines_style": { "style": "styles.json" } }
}
"styles": {
"coastlines": {
"style": "styles.json"
}
},
"data": {
"coastlines": {
"pmtiles": "https://deppcpublicstorage.blob.core.windows.net/output/dep_ls_coastlines/dep_ls_coastlines_0-7-0-54.pmtiles"
}
}
}
Empty file added data/.gitkeep
Empty file.
11 changes: 11 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
services:
tileserver:
image: maptiler/tileserver-gl
volumes:
- ./config.json:/data/config.json
- ./styles.json:/data/styles.json
ports:
- 8080:8080
command:
- "--config"
- "/data/config.json"
Loading

0 comments on commit a71cb6c

Please sign in to comment.