diff --git a/Dockerfile b/Dockerfile index 8de716c..e91d70e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,8 @@ EXPOSE 4000 RUN mkdir -p ${APP_DIR} -COPY . ./ +COPY . *.env ./ + RUN yarn install --no-progress && \ yarn build-release diff --git a/package.json b/package.json index 32eb556..1975c9c 100644 --- a/package.json +++ b/package.json @@ -92,9 +92,8 @@ "prepare": "husky install", "import-users": "yarn build && node build/db/utils/jobs/migration/CreateUsersCollection.js", "maptiles:export-db": "node build/db/utils/jobs/MapTiles/exportCmd.js", - "maptiles:generate": "./scripts/gen-tiles.sh", - "maptiles:upload": "node build/db/utils/jobs/MapTiles/uploadCmd.js", - "maptiles:full": "yarn build && yarn maptiles:export-db && yarn maptiles:generate && yarn maptiles:upload" + "maptiles:upload": "./scripts/upload-tiles.sh", + "maptiles:full": "yarn build && yarn maptiles:export-db && yarn maptiles:upload" }, "standard": { "plugins": [ diff --git a/scripts/gen-tiles.sh b/scripts/gen-tiles.sh deleted file mode 100755 index 27eecad..0000000 --- a/scripts/gen-tiles.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# Generate map tiles from geojson exports -# See also https://github.com/felt/tippecanoe - -SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) - -. ${SCRIPT_DIR}/../.env -. ${SCRIPT_DIR}/../.env.local - -echo "Generating crags tiles file" -tippecanoe --force -o ${MAPTILES_WORKING_DIR}/crags.mbtiles -l crags -n "Crags" -zg ${MAPTILES_WORKING_DIR}/crags.*.geojson - -echo "Generating crag group tiles file" -tippecanoe --force -o ${MAPTILES_WORKING_DIR}/crag-groups.mbtiles -l crag-groups -n "Crag groups" -zg ${MAPTILES_WORKING_DIR}/crag-groups.geojson - -exit $? \ No newline at end of file diff --git a/scripts/upload-tiles.sh b/scripts/upload-tiles.sh new file mode 100755 index 0000000..de9e232 --- /dev/null +++ b/scripts/upload-tiles.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# 1. Generate pmtiles tiles from geojson exports +# 2. Upload to S3-compatible storage +# See also https://github.com/felt/tippecanoe + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +set -a +. ${SCRIPT_DIR}/../.env +. ${SCRIPT_DIR}/../.env.local +set +a + +S3_DEST=':s3,provider=Cloudflare,no_check_bucket=true,env_auth=true,acl=private:maptiles' + +echo "Generating crags tiles file" +#tippecanoe --force -o ${MAPTILES_WORKING_DIR}/crags.pmtiles -l crags -n "Crags" -zg ${MAPTILES_WORKING_DIR}/crags.*.geojson +echo "**Uploading to remote storage" +rclone copy ${MAPTILES_WORKING_DIR}/crags.pmtiles ${S3_DEST} + +echo "Generating crag group tiles file" +#tippecanoe --force -o ${MAPTILES_WORKING_DIR}/crag-groups.pmtiles -l crag-groups -n "Crag groups" -zg ${MAPTILES_WORKING_DIR}/crag-groups.geojson +echo "**Uploading to remote storage" +rclone copy ${MAPTILES_WORKING_DIR}/crag-groups.pmtiles ${S3_DEST} + +exit $? \ No newline at end of file