diff --git a/.github/workflows/publish-docker-image.yml b/.github/workflows/publish-docker-image.yml new file mode 100644 index 0000000..0c0c103 --- /dev/null +++ b/.github/workflows/publish-docker-image.yml @@ -0,0 +1,45 @@ +name: "Build and publish container image" + +on: + workflow_dispatch: + push: + branches: + - "main" + tags: + - "[0-9]+.[0-9]+.[0-9]+*" + + +env: + REGISTRY: "ghcr.io" + IMAGE_NAME: "${{ github.repository_owner }}/pdgraster" + IMAGE_TAG: "${{ github.ref_type == 'tag' && github.ref_name || 'latest' }}" + + +jobs: + + build-and-release-image: + name: "Build and release container image" + runs-on: "ubuntu-latest" + + permissions: + packages: "write" + attestations: "write" + + steps: + - name: "Check out repository" + uses: "actions/checkout@v3" + + - name: "Build container image" + run: | + docker build --tag "${REGISTRY}/${IMAGE_NAME}:${IMAGE_TAG}" . + + - name: "GHCR login" + uses: "docker/login-action@v2" + with: + registry: "${{ env.REGISTRY }}" + username: "${{ github.repository_owner }}" + password: "${{ secrets.GITHUB_TOKEN }}" + + - name: "Push to GHCR" + run: | + docker push "${REGISTRY}/${IMAGE_NAME}:${IMAGE_TAG}" diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1cce9ba --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM python:3.10-slim + +# Install transitive dependencies +RUN apt-get update \ + && apt-get install -y git libspatialindex-dev libgdal-dev libproj-dev + +# Add source +WORKDIR /app +ADD . . + +# Install pdgraster from source +RUN pip install . + +CMD ["python"] diff --git a/pyproject.toml b/pyproject.toml index 4750736..de3688a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "pdgraster" version = "0.9.2" -description = "Geospatial data rasterization workflow" +description = "Rasterization to GeoTiff and web-based tiles for the PDG Visualization pipeline" authors = [ "Robyn Thiessen-Bock ", "Juliet Cohen ", @@ -32,6 +32,7 @@ colormaps = "== 0.4.0" Pillow = ">= 9, < 10" rasterio = ">= 1.2, < 2" pydantic = "1.10.9" +pdgstaging = { git="https://github.com/PermafrostDiscoveryGateway/viz-staging.git" } [tool.poetry.group.dev.dependencies] pytest = ">=7" diff --git a/setup.py b/setup.py deleted file mode 100644 index 4b47975..0000000 --- a/setup.py +++ /dev/null @@ -1,40 +0,0 @@ -from setuptools import setup - -with open('README.md', 'r') as fh: - long_description = fh.read() - -setup( - author='Robyn Thiessen-Bock, Juliet Cohen', - author_email='thiessenbock@nceas.ucsb.edu, jcohen@nceas.ucsb.edu', - name='pdgraster', - version='0.9.2', - description='Rasterization to GeoTiff and web-based tiles for the PDG ' - 'Visualization pipeline', - long_description=long_description, - long_description_content_type='text/markdown', - url='https://github.com/PermafrostDiscoveryGateway/viz-raster', - packages=['pdgraster'], - install_requires=[ - 'numpy >= 1.2, < 2', - 'shapely >= 2, < 3', - 'geopandas >= 0.12.2, < 1', - 'coloraide >= 0.10, < 1', - 'Pillow >= 9, < 10', - 'morecantile >= 3.1, < 4', - 'Rtree >= 0.9, < 1', - 'rasterio >= 1.2, < 2', - 'pydantic == 1.10.9', - 'pdgstaging @ git+https://github.com/PermafrostDiscoveryGateway/viz-staging.git#egg=pdgstaging', - 'colormaps == 0.4.0' - ], - python_requires='>=3.9, <4', - classifiers=[ - 'Development Status :: 2 - Pre-Alpha', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: Apache Software License', - 'Natural Language :: English', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.9', - ], - license='Apache Software License 2.0', -)