Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/dev-vip-pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build and push dev_vip image

on:
pull_request:
branches:
- develop

env:
IMAGE_NAME: hsldevcom/hsl-map-server

jobs:
build-and-push:
name: Build and push dev_vip
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
clean: 'true'
fetch-depth: 2

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_AUTH }}

- name: Build and push production image with tag dev_vip
uses: docker/build-push-action@v6
with:
context: .
push: true
target: production
tags: "${{ env.IMAGE_NAME }}:dev_vip"
50 changes: 50 additions & 0 deletions .github/workflows/pr-pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: PR pipeline

on:
pull_request:
branches:
- develop

env:
IMAGE_NAME: hsldevcom/hsl-map-server
TEST_STAGE: tester
PRODUCTION_STAGE: production

jobs:
build-check-test-push:
name: Build, check, test, push
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
clean: 'true'
fetch-depth: 2

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build tester image
uses: docker/build-push-action@v6
with:
context: .
load: true
target: "${{ env.TEST_STAGE }}"
tags: "${{ env.IMAGE_NAME }}:${{ env.TEST_STAGE }}"

- name: Run checks and tests inside Docker
run: docker run --rm "${{ env.IMAGE_NAME }}:${{ env.TEST_STAGE }}"

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_AUTH }}

- name: Build and push production image
uses: docker/build-push-action@v6
with:
context: .
push: true
target: "${{ env.PRODUCTION_STAGE }}"
tags: "${{ env.IMAGE_NAME }}:pr-${{ github.event.pull_request.number }}"
14 changes: 13 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM node:16-bullseye-slim
FROM node:18-bullseye-slim AS base

ENV WORK=/opt/hsl-map-server
ENV DATA_DIR=${WORK}/data
ENV NODE_OPTS ""

Check warning on line 5 in Dockerfile

View workflow job for this annotation

GitHub Actions / Build, check, test, push

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/

Check warning on line 5 in Dockerfile

View workflow job for this annotation

GitHub Actions / Build and push dev_vip

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/
ENV NODE_ENV=production

RUN apt-get update \
Expand All @@ -29,12 +29,24 @@

RUN mkdir -p ${DATA_DIR}

# ---------------------------------------------------------------------------
# tester stage: used by CI to run checks/tests without downloading mbtiles
# ---------------------------------------------------------------------------
FROM base AS tester

CMD ["yarn", "test"]

# ---------------------------------------------------------------------------
# production stage: downloads the mbtiles dataset and runs the tile server
# ---------------------------------------------------------------------------
FROM base AS production

# OpenMapTiles dataset generated by hsldevcom
RUN wget https://hslstoragekarttatuotanto.blob.core.windows.net/openmaptiles/tiles.mbtiles -q -t 3 -O ${DATA_DIR}/finland.mbtiles

EXPOSE 8080

CMD \

Check warning on line 49 in Dockerfile

View workflow job for this annotation

GitHub Actions / Build and push dev_vip

JSON arguments recommended for ENTRYPOINT/CMD to prevent unintended behavior related to OS signals

JSONArgsRecommended: JSON arguments recommended for CMD to prevent unintended behavior related to OS signals More info: https://docs.docker.com/go/dockerfile/rule/json-args-recommended/
(Xorg -dpi 96 -nolisten tcp -noreset +extension GLX +extension RANDR +extension RENDER -logfile ./10.log -config ./xorg.conf :10 & \
DISPLAY=":10" yarn forever start --spinSleepTime 60000 --minUptime 30000 -c "node ${NODE_OPTS}" \
node_modules/tessera/bin/tessera.js --port 8080 --config config.js --multiprocess \
Expand Down
20 changes: 18 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hsl-map-server",
"version": "1.0.1",
"version": "1.0.2",
"description": "HSL map server",
"main": "config.js",
"scripts": {
Expand Down Expand Up @@ -29,8 +29,24 @@
"tilelive-gl": "hsldevcom/tilelive-gl"
},
"devDependencies": {
"eslint": "^8.33.0",
"eslint": "^8.57.1",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.27.5"
},
"resolutions": {
"minimist": "^1.2.8",
"form-data": "^4.0.5",
"cross-spawn": "^7.0.6",
"minimatch": "^9.0.5",
"tar": "^7.5.11",
"tar-fs": "^2.1.4",
"semver": "^7.7.4",
"body-parser": "^1.20.3",
"path-to-regexp": "0.1.12",
"flatted": "^3.4.2",
"nconf": "^0.13.0",
"braces": "^3.0.3",
"sharp": "^0.32.6",
"socks": "^2.8.7"
}
}
Loading
Loading