Skip to content

Commit

Permalink
Update and fix demo (#809)
Browse files Browse the repository at this point in the history
* Use `postgis/postgis` image for the DB
* Build frontend image inside the docker
* Upgrade all packages except styled-components - that one causes some
errors
* Add yarn.lock to the repo
* Add justfile for simplicity
* Bump martin docker image version in a few places
  • Loading branch information
nyurik authored Aug 15, 2023
1 parent d85d95d commit fa50eea
Show file tree
Hide file tree
Showing 9 changed files with 2,737 additions and 370 deletions.
10 changes: 3 additions & 7 deletions demo/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
# Martin Use Case

## Usage
## Usage in Docker-Compose

```shell
docker-compose up
just up
```

Open `localhost` in your browser

# Requirements

Frontend requires [martin v0.6.2](https://github.com/maplibre/martin/tree/v0.6.2)
* Open http://localhost in your browser
7 changes: 1 addition & 6 deletions demo/db/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
FROM postgres:12

ENV PG_MAJOR=12
ENV POSTGIS_MAJOR=3
FROM postgis/postgis:15-3.3

RUN set -x \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts \
wget \
ca-certificates \
unzip \
Expand Down
1 change: 0 additions & 1 deletion demo/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ services:
context: ./frontend
dockerfile: Dockerfile
restart: unless-stopped
command: ["npm", "run", "preview"]
depends_on:
- tiles
ports:
Expand Down
6 changes: 4 additions & 2 deletions demo/frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:20-alpine as builder
FROM node:alpine as builder

WORKDIR /usr/src/app

Expand All @@ -7,4 +7,6 @@ COPY yarn.lock .
RUN yarn install

COPY . .
CMD yarn run build
RUN yarn run build

CMD ["yarn", "run", "preview"]
18 changes: 10 additions & 8 deletions demo/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,26 @@
"dependencies": {
"date-fns": "^2.30.0",
"debounce": "1.2.1",
"mapbox-gl": "npm:empty-npm-package@^1.0.0",
"maplibre-gl": "^3.2.0",
"maplibre-gl": "^3.3.0",
"normalize.css": "8.0.1",
"react": "18.2.0",
"react-day-picker": "^8.8.0",
"react-day-picker": "^8.7.1",
"react-dom": "18.2.0",
"react-map-gl": "^7.1.2",
"react-map-gl": "^7.1.0",
"react-scroll-parallax": "3.4.2",
"styled-components": "5.3.11"
},
"devDependencies": {
"@types/node": "^20.4.2",
"@types/react": "^18.2.15",
"@types/node": "^20.5.0",
"@types/react": "^18.2.20",
"@types/react-dom": "^18.2.7",
"@vitejs/plugin-react": "^4.0.3",
"@vitejs/plugin-react": "^4.0.4",
"eslint": "8.47.0",
"eslint-config-airbnb": "19.0.4",
"eslint-config-airbnb-base": "15.0.0",
"eslint-config-react-app": "7.0.1",
"typescript": "^5.1.6",
"vite": "^4.4.4",
"vite": "^4.4.9",
"vite-plugin-mkcert": "^1.16.0",
"vite-tsconfig-paths": "^4.2.0"
},
Expand Down
3,040 changes: 2,696 additions & 344 deletions demo/frontend/yarn.lock

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions demo/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env just --justfile

set shell := ["bash", "-c"]

@_default:
just --list --unsorted

clean:
rm -rf frontend/node_modules

up:
docker-compose up

up-build:
docker-compose up --build

up-backend:
docker-compose up db tiles --detach

frontend *ARGS:
docker-compose up frontend {{ ARGS }}
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3"

services:
martin:
image: ghcr.io/maplibre/martin:v0.7.0
image: ghcr.io/maplibre/martin:v0.8.7
restart: unless-stopped
ports:
- "3000:3000"
Expand Down
2 changes: 1 addition & 1 deletion docs/src/run-with-docker-compose.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ version: '3'

services:
martin:
image: ghcr.io/maplibre/martin:v0.7.0
image: ghcr.io/maplibre/martin:v0.8.7
restart: unless-stopped
ports:
- "3000:3000"
Expand Down

0 comments on commit fa50eea

Please sign in to comment.