diff --git a/service-templates/Dockerfile b/service-templates/Dockerfile index 7bd57be91..b353393de 100755 --- a/service-templates/Dockerfile +++ b/service-templates/Dockerfile @@ -1,11 +1,13 @@ # Add copyright statement here -FROM ghcr.io/osgeo/gdal:alpine-small-latest +FROM ghcr.io/osgeo/gdal:alpine-small-3.9.3 -RUN apk add bash build-base gcc g++ gfortran openblas-dev cmake python3 python3-dev libffi-dev netcdf-dev libxml2-dev libxslt-dev libjpeg-turbo-dev zlib-dev hdf5 hdf5-dev gdal-dev gdal-tools - -RUN python -m ensurepip --upgrade -RUN pip3 install gdal numpy netCDF4 matplotlib harmony-service-lib +RUN apk add bash build-base gcc g++ gfortran openblas-dev cmake python3 python3-dev libffi-dev netcdf-dev libxml2-dev libxslt-dev libjpeg-turbo-dev zlib-dev hdf5 hdf5-dev +RUN python3 -m venv service-env +ENV PATH="/service-env/bin:$PATH" +RUN python3 -m ensurepip --upgrade +RUN pip3 install numpy netCDF4 matplotlib harmony-service-lib +RUN pip3 install "gdal==3.9.3" # Create a new user RUN adduser -D -s /bin/sh -h /home/dockeruser -g "" -u 1000 dockeruser diff --git a/service-templates/sample_service.py b/service-templates/sample_service.py index 9fd77c7d4..09cc868d7 100644 --- a/service-templates/sample_service.py +++ b/service-templates/sample_service.py @@ -12,10 +12,10 @@ from tempfile import mkdtemp from pystac import Asset -import harmony -from harmony.util import generate_output_filename, stage, download +import harmony_service_lib +from harmony_service_lib.util import generate_output_filename, stage, download -class ExampleAdapter(harmony.BaseHarmonyAdapter): +class ExampleAdapter(harmony_service_lib.BaseHarmonyAdapter): """ Shows an example of what a service adapter implementation looks like """ @@ -31,7 +31,7 @@ def process_item(self, item, source): ---------- item : pystac.Item the item that should be processed - source : harmony.message.Source + source : harmony_service_lib.message.Source the input source defining the variables, if any, to subset from the item Returns @@ -109,12 +109,12 @@ def main(): """ parser = argparse.ArgumentParser(prog='example', description='Run an example service') - harmony.setup_cli(parser) + harmony_service_lib.setup_cli(parser) args = parser.parse_args() - if (harmony.is_harmony_cli(args)): - harmony.run_cli(parser, args, ExampleAdapter) + if (harmony_service_lib.is_harmony_cli(args)): + harmony_service_lib.run_cli(parser, args, ExampleAdapter) else: run_cli(args)