diff --git a/pcstac/Dockerfile b/pcstac/Dockerfile index c0d66862..a206280c 100644 --- a/pcstac/Dockerfile +++ b/pcstac/Dockerfile @@ -9,11 +9,15 @@ WORKDIR /opt/src COPY pcstac /opt/src/pcstac COPY pccommon /opt/src/pccommon -RUN pip install -U "setuptools>=65.5.1" +RUN --mount=type=cache,target=/root/.cache \ + pip install -U "setuptools>=65.5.1" # The order of these pip installs is important :( -RUN pip install -r ./pccommon/requirements.txt -RUN pip install -r ./pcstac/requirements-server.txt -RUN pip install --no-deps -e ./pccommon -e ./pcstac[server] +RUN --mount=type=cache,target=/root/.cache \ + pip install -r ./pccommon/requirements.txt +RUN --mount=type=cache,target=/root/.cache \ + pip install -r ./pcstac/requirements-server.txt +RUN --mount=type=cache,target=/root/.cache \ + pip install --no-deps -e ./pccommon -e ./pcstac[server] ENV APP_HOST=0.0.0.0 ENV APP_PORT=81 diff --git a/pcstac/Dockerfile.dev b/pcstac/Dockerfile.dev index b61d44a3..380d98eb 100644 --- a/pcstac/Dockerfile.dev +++ b/pcstac/Dockerfile.dev @@ -1,6 +1,9 @@ FROM pc-apis-stac -COPY requirements-dev.txt requirements-dev.txt -RUN pip install -r requirements-dev.txt -RUN pip install -e ./pccommon[dev] -e ./pcstac +RUN --mount=type=cache,target=/root/.cache \ + --mount=type=bind,source=requirements-dev.txt,target=requirements-dev.txt \ + pip install -r requirements-dev.txt + +RUN --mount=type=cache,target=/root/.cache \ + pip install -e ./pccommon[dev] -e ./pcstac diff --git a/pctiler/Dockerfile b/pctiler/Dockerfile index adac0f13..caca68f5 100644 --- a/pctiler/Dockerfile +++ b/pctiler/Dockerfile @@ -6,11 +6,15 @@ COPY pccommon /opt/src/pccommon COPY pctiler /opt/src/pctiler # Install the local modules in the new environment -RUN /bin/sh -c "python -m pip install -U 'setuptools>=65.5.1'" +RUN --mount=type=cache,target=/root/.cache \ + /bin/sh -c "python -m pip install -U 'setuptools>=65.5.1'" # The order of these pip installs is important :( -RUN /bin/sh -c "python -m pip install -r ./pccommon/requirements.txt" -RUN /bin/sh -c "python -m pip install -r ./pctiler/requirements-server.txt" -RUN /bin/sh -c "python -m pip install --no-deps -e ./pccommon -e ./pctiler[server]" +RUN --mount=type=cache,target=/root/.cache \ + /bin/sh -c "python -m pip install -r ./pccommon/requirements.txt" +RUN --mount=type=cache,target=/root/.cache \ + /bin/sh -c "python -m pip install -r ./pctiler/requirements-server.txt" +RUN --mount=type=cache,target=/root/.cache \ + /bin/sh -c "python -m pip install --no-deps -e ./pccommon -e ./pctiler[server]" # GDAL config ENV GDAL_CACHEMAX 200 diff --git a/pctiler/Dockerfile.dev b/pctiler/Dockerfile.dev index 06141a7f..12f95fbe 100644 --- a/pctiler/Dockerfile.dev +++ b/pctiler/Dockerfile.dev @@ -4,5 +4,9 @@ RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash COPY requirements-dev.txt requirements-dev.txt -RUN python3 -m pip install -r requirements-dev.txt -RUN python3 -m pip install -r pctiler/requirements-dev.txt +RUN --mount=type=cache,target=/root/.cache \ + --mount=type=bind,source=requirements-dev.txt,target=requirements-dev.txt \ + python3 -m pip install -r requirements-dev.txt + +RUN --mount=type=cache,target=/root/.cache \ + python3 -m pip install -r pctiler/requirements-dev.txt diff --git a/pctiler/tests/test_asset_read.py b/pctiler/tests/test_asset_read.py index 9a12e209..67baaa03 100644 --- a/pctiler/tests/test_asset_read.py +++ b/pctiler/tests/test_asset_read.py @@ -1,11 +1,20 @@ import planetary_computer as pc import rasterio -from titiler.core import utils as titiler_utils + def test_rasterio_lerc_decompression() -> None: # Read a LERC file from Planetary Computer - url = "https://usgslidareuwest.blob.core.windows.net/usgs-3dep-cogs/usgs-cogs/USGS_LPC_VA_Fairfax_County_2018/hag/USGS_LPC_VA_Fairfax_County_2018-hag-2m-3-1.tif" + url = ( + "https://usgslidareuwest.blob.core.windows.net/" + "usgs-3dep-cogs/usgs-cogs/" + "USGS_LPC_VA_Fairfax_County_2018/hag/" + "USGS_LPC_VA_Fairfax_County_2018-hag-2m-3-1.tif" + ) signed_url = pc.sign(url) + # Although we call rasterio, this is really testing GDAL's LERC support. + # If the version of GDAL being shipped doesn't support LERC, then an exception like + # "rasterio.errors.RasterioIOError: Cannot open TIFF file due to missing codec."" + # Would be thrown. with rasterio.open(signed_url) as src: - compression = src.profile.get('compress') - assert compression == 'lerc_zstd' \ No newline at end of file + compression = src.profile.get("compress") + assert compression == "lerc_zstd"