diff --git a/opensearch-maps-server/.dockerignore b/opensearch-maps-server/.dockerignore index 475c70b..5c17410 100644 --- a/opensearch-maps-server/.dockerignore +++ b/opensearch-maps-server/.dockerignore @@ -1,3 +1,4 @@ node_modules npm-debug.log -dist \ No newline at end of file +dist +.idea diff --git a/opensearch-maps-server/.gitignore b/opensearch-maps-server/.gitignore index 475c70b..5c17410 100644 --- a/opensearch-maps-server/.gitignore +++ b/opensearch-maps-server/.gitignore @@ -1,3 +1,4 @@ node_modules npm-debug.log -dist \ No newline at end of file +dist +.idea diff --git a/opensearch-maps-server/Dockerfile b/opensearch-maps-server/Dockerfile index 47c2988..e079d2e 100644 --- a/opensearch-maps-server/Dockerfile +++ b/opensearch-maps-server/Dockerfile @@ -1,33 +1,47 @@ +# Copyright OpenSearch Contributors +# SPDX-License-Identifier: Apache-2.0 + +########################### Stage 0 ######################## +FROM amazonlinux:2 AS stage_0 + +WORKDIR /src + +RUN yum install -y tar gzip unzip && yum clean all + +RUN mkdir GeoJSONData && \ + cd GeoJSONData && \ + curl -SL -o geo-json-files.tar.gz https://maps.opensearch.org/offline/natural-earth-geo-json.tar.gz && \ + tar -xzf geo-json-files.tar.gz --strip-components=1 && \ + rm geo-json-files.tar.gz && pwd && ls + +RUN mkdir oss_compliance && \ + cd oss_compliance && \ + curl -SL -o oss_compliance.zip https://aws-dlinfra-utilities.s3.amazonaws.com/oss_compliance.zip && \ + unzip oss_compliance.zip && \ + rm oss_compliance.zip + +########################### Stage 1 ######################## FROM amazonlinux:2 WORKDIR /usr/src/app -RUN curl -sL https://rpm.nodesource.com/setup_16.x | bash - && \ - yum install -y nodejs wget tar gzip unzip python37 && \ - yum clean all +COPY --from=stage_0 /src/GeoJSONData public/vectors/data +COPY --from=stage_0 /src/oss_compliance . -RUN pip3 install --no-cache --upgrade \ - "requests>=2.18.4,<=2.22.0" +RUN curl -SL https://rpm.nodesource.com/setup_16.x | bash && \ + yum install -y nodejs-16.17.1 python3 tar gzip && pip3 install requests==2.28.1 && yum clean all COPY package*.json ./ RUN npm install COPY . . -RUN mkdir -p public/vectors/data && \ - cd public/vectors/data && \ - wget -O vectors.tar.gz https://maps.opensearch.org/offline/natural-earth-geo-json.tar.gz && \ - tar -xzf vectors.tar.gz --strip-components=1 && \ - rm vectors.tar.gz - COPY entrypoint.sh . RUN chmod +x entrypoint.sh ENTRYPOINT ["./entrypoint.sh"] -EXPOSE 8080 +RUN chmod +x oss_compliance/generate_oss_compliance.sh && \ + oss_compliance/generate_oss_compliance.sh /usr/src/app python3 && \ + cp oss_compliance/python_packages/piplicenses/PACKAGES_LICENSES_JSON.json PACKAGES_LICENSES_JSON.json && \ + rm -rf oss_compliance* \ -RUN wget -O oss_compliance.zip https://aws-dlinfra-utilities.s3.amazonaws.com/oss_compliance.zip \ - && unzip oss_compliance.zip \ - && chmod +x oss_compliance/generate_oss_compliance.sh \ - && oss_compliance/generate_oss_compliance.sh /usr/src/app python3 \ - && cp oss_compliance/python_packages/piplicenses/PACKAGES_LICENSES_JSON.json PACKAGES_LICENSES_JSON.json \ - && rm -rf oss_compliance* \ No newline at end of file +EXPOSE 8080 diff --git a/opensearch-maps-server/README.md b/opensearch-maps-server/README.md index 90b5957..62bfc8f 100644 --- a/opensearch-maps-server/README.md +++ b/opensearch-maps-server/README.md @@ -23,12 +23,12 @@ Option1: Use the tiles set provided by OpenSearch maps service docker volume create tiles-data ``` * Then download tiles set from OpenSearch maps service, we now have 0-8 and 0-10 planet tiles set available. - * https://maps.opensearch.org/offline/planet-osm-default-z0-z8-20220613.tar.gz - * https://maps.opensearch.org/offline/planet-osm-default-z0-z10-20220613.tar.gz + * https://maps.opensearch.org/offline/planet-osm-default-z0-z8.tar.gz + * https://maps.opensearch.org/offline/planet-osm-default-z0-z10.tar.gz ``` docker run \ --e DOWNLOAD_TILES=https://maps.opensearch.org/offline/planet-osm-default-z0-z8-20220613.tar.gz \ +-e DOWNLOAD_TILES=https://maps.opensearch.org/offline/planet-osm-default-z0-z8.tar.gz \ -v tiles-data:/usr/src/app/public/tiles/data/ \ osm-server \ import diff --git a/opensearch-maps-server/entrypoint.sh b/opensearch-maps-server/entrypoint.sh index d6d6644..0ff9ba7 100644 --- a/opensearch-maps-server/entrypoint.sh +++ b/opensearch-maps-server/entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -e @@ -21,7 +21,7 @@ if [ "${1}" = "import" ]; then cd public/tiles/data if [ -n "${DOWNLOAD_TILES:-}" ]; then echo "INFO: Download Tiles images: $DOWNLOAD_TILES" - wget "$DOWNLOAD_TILES" -O tiles.tar.gz + curl -SL -o tiles.tar.gz "$DOWNLOAD_TILES" tar -xzf tiles.tar.gz --strip-components=1 rm tiles.tar.gz fi