Repository: ASFHyP3/asf-tools (language: python)

Issue:
Tweak the README



Discussion / hints:

Fix patch:
diff --git a/.github/workflows/tag-version.yml b/.github/workflows/tag-version.yml
new file mode 100644
index 00000000..1696384a
--- /dev/null
+++ b/.github/workflows/tag-version.yml
@@ -0,0 +1,12 @@
+name: Tag version
+
+on:
+  push:
+    branches:
+      - main
+
+jobs:
+  call-bump-version-workflow:
+    uses: ASFHyP3/actions/.github/workflows/reusable-bump-version.yml@main
+    secrets:
+      USER_TOKEN: ${{ secrets.TOOLS_BOT_PAK }}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a4778766..2889f5e2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 and this project adheres to [PEP 440](https://www.python.org/dev/peps/pep-0440/) 
 and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 
+## [0.3.2]
+
+### Added
+* We now provide an ASF Tools docker image: `ghcr.io/asfhyp3/asf-tools`. For usage, see the `asf_tools` [README](asf_tools/README.md).
 
 ## [0.3.1](https://github.com/ASFHyP3/asf-tools/compare/v0.3.0...v0.3.1)
 
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 00000000..aceacc83
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,42 @@
+FROM condaforge/mambaforge:latest
+
+# For opencontainers label definitions, see:
+#    https://github.com/opencontainers/image-spec/blob/master/annotations.md
+LABEL org.opencontainers.image.title="ASF Tools"
+LABEL org.opencontainers.image.description="Plugin for tools utilized in SAR processing"
+LABEL org.opencontainers.image.vendor="Alaska Satellite Facility"
+LABEL org.opencontainers.image.authors="ASF APD/Tools Team <uaf-asf-apd@alaska.edu>"
+LABEL org.opencontainers.image.licenses="BSD-3-Clause"
+LABEL org.opencontainers.image.url="https://github.com/ASFHyP3/asf-tools"
+LABEL org.opencontainers.image.source="https://github.com/ASFHyP3/asf-tools"
+LABEL org.opencontainers.image.documentation="https://hyp3-docs.asf.alaska.edu"
+
+ARG DEBIAN_FRONTEND=noninteractive
+ENV PYTHONDONTWRITEBYTECODE=true
+
+RUN apt-get update && apt-get install -y --no-install-recommends unzip vim && \
+    apt-get clean && rm -rf /var/lib/apt/lists/*
+
+ARG CONDA_UID=1000
+ARG CONDA_GID=1000
+
+RUN groupadd -g "${CONDA_GID}" --system conda && \
+    useradd -l -u "${CONDA_UID}" -g "${CONDA_GID}" --system -d /home/conda -m  -s /bin/bash conda && \
+    chown -R conda:conda /opt && \
+    echo ". /opt/conda/etc/profile.d/conda.sh" >> /home/conda/.profile && \
+    echo "conda activate base" >> /home/conda/.profile
+
+USER ${CONDA_UID}
+SHELL ["/bin/bash", "-l", "-c"]
+WORKDIR /home/conda/
+
+COPY --chown=${CONDA_UID}:${CONDA_GID} . /asf-tools/
+
+RUN mamba env create -f /asf-tools/environment.yml && \
+    conda clean -afy && \
+    conda activate asf-tools && \
+    sed -i 's/conda activate base/conda activate asf-tools/g' /home/conda/.profile && \
+    python -m pip install --no-cache-dir /asf-tools
+
+ENTRYPOINT ["/usr/bin/bash"]
+CMD ["-l"]
diff --git a/asf_tools/README.md b/asf_tools/README.md
index c80acc47..cb0f7c1e 100644
--- a/asf_tools/README.md
+++ b/asf_tools/README.md
@@ -21,18 +21,46 @@ environments via [Anaconda/Miniconda](https://docs.conda.io/projects/conda/en/la
 It is also possible to use [Python virtual environments](https://docs.python.org/3/tutorial/venv.html),
 but installation of non-python dependencies (e.g., `gdal`) can be challenging. 
 
-`asf_tools` can be installed into a conda environment with
+`asf_tools` can be installed into a conda environment with:
 
 ```
 conda install -c conda-forge asf_tools
 ```
 
-or into a virtual environment with
+or into a virtual environment with:
 
 ```
 python -m pip install asf_tools
 ```
 
+### Running as a Docker container
+
+We also publish a [Docker](https://docs.docker.com/get-started/) image for `asf_tools`, with all the dependencies
+pre-installed, to the GitHub Container Registry:
+<https://github.com/ASFHyP3/asf-tools/pkgs/container/asf-tools>.
+
+You can pull an image with the latest released version of `asf_tools`  with the command:
+```
+docker pull ghcr.io/asfhyp3/asf-tools:latest
+```
+
+Or, the development version with: 
+```
+docker pull ghcr.io/asfhyp3/asf-tools:test
+```
+
+And then run the container with:
+```
+docker run --rm -it ghcr.io/asfhyp3/asf-tools:latest
+```
+which will drop you into a `bash` shell inside the container with an active `asf-tools` conda environment. 
+
+To move data between your local (host) machine and the container, you can mount a 
+[volume](https://docs.docker.com/storage/volumes/) with:
+```
+docker run --rm -it -v /path/to/data:/home/conda/data ghcr.io/asfhyp3/asf-tools:latest
+```
+
 ## Quick Usage
 
 ### Local Resolution Weighted Composite


Test patch:
diff --git a/.github/workflows/test-and-build.yml b/.github/workflows/test-and-build.yml
new file mode 100644
index 00000000..7bf549fb
--- /dev/null
+++ b/.github/workflows/test-and-build.yml
@@ -0,0 +1,31 @@
+name: Test and build
+
+on:
+  push:
+    branches:
+      - main
+      - develop
+  pull_request:
+    branches:
+      - main
+      - develop
+
+jobs:
+  call-pytest-workflow:
+    uses: ASFHyP3/actions/.github/workflows/reusable-pytest.yml@main
+    with:
+      local_package_name: asf_tools
+      conda_env_name: asf-tools
+
+  call-version-info-workflow:
+    uses: ASFHyP3/actions/.github/workflows/reusable-version-info.yml@main
+    with:
+      conda_env_name: asf-tools
+
+  call-docker-ghcr-workflow:
+    needs: call-version-info-workflow
+    uses: ASFHyP3/actions/.github/workflows/reusable-docker-ghcr.yml@main
+    with:
+      version_tag: ${{ needs.call-version-info-workflow.outputs.version_tag }}
+    secrets:
+      USER_TOKEN: ${{ secrets.TOOLS_BOT_PAK }}
diff --git a/.github/workflows/test-and-tag.yml b/.github/workflows/test-and-tag.yml
deleted file mode 100644
index d613250a..00000000
--- a/.github/workflows/test-and-tag.yml
+++ /dev/null
@@ -1,101 +0,0 @@
-name: Test and tag
-
-on:
-  push:
-    branches:
-      - main
-      - develop
-  pull_request:
-    branches:
-      - main
-      - develop
-
-jobs:
-  pytest:
-    runs-on: ubuntu-latest
-    strategy:
-      matrix:
-        python-version: [3.8, 3.9]
-
-    steps:
-      - uses: actions/checkout@v2
-
-      - uses: conda-incubator/setup-miniconda@v2
-        with:
-          mamba-version: "*"
-          python-version: ${{ matrix.python-version }}
-          activate-environment: asf-tools
-          environment-file: environment.yml
-
-      - name: Pytest in conda environment
-        shell: bash -l {0}
-        run: |
-          python -m pip install .[develop]
-          pytest --cov=asf_tools
-
-  tag:
-    runs-on: ubuntu-latest
-    needs: pytest
-    if: github.ref == 'refs/heads/main'
-    outputs:
-      SDIST_VERSION:  ${{ steps.build.outputs.version }}
-    steps:
-      - uses: actions/checkout@v2
-        with:
-          fetch-depth: 0
-          token: ${{ secrets.TOOLS_BOT_PAK }}
-
-      - name: Get associated PR
-        uses: helaili/github-graphql-action@2.0.1
-        env:
-          GITHUB_TOKEN: ${{ secrets.TOOLS_BOT_PAK }}
-        with:
-          query: .github/queries/associated-pr.query.yml
-          outputFile: pr.json
-          owner: ASFHyP3
-          name: asf-tools
-          sha: ${{ github.sha }}
-
-      - name: Get PR labels
-        uses: helaili/github-graphql-action@2.0.1
-        env:
-          GITHUB_TOKEN: ${{ secrets.TOOLS_BOT_PAK }}
-        with:
-          query: .github/queries/pr-labels.query.yml
-          outputFile: labels.json
-          owner: ASFHyP3
-          name: asf-tools
-
-      - name: Upload query artifacts for debugging
-        uses: actions/upload-artifact@v2
-        with:
-          name: query-responces
-          path: '*.json'
-
-      - uses: actions/setup-python@v1
-        with:
-          python-version: 3.8
-
-      - name: Install dependencies
-        run: |
-          python -m pip install --upgrade pip
-          python -m pip install bump2version
-
-      - name: Tag version
-        run: |
-          git fetch origin +refs/tags/*:refs/tags/*
-          git config user.email "UAF-asf-apd@alaska.edu"
-          git config user.name "tools-bot"
-
-          LABEL_QUERY='.data.repository.pullRequest.labels.nodes[].name'
-          SELECT='select(. == "major" or . == "minor" or . == "patch")'
-          BUMP_PART=$(jq --raw-output  "${LABEL_QUERY} | ${SELECT}" labels.json | sort | head -1)
-
-          PR_QUERY='.data.repository.commit.associatedPullRequests.edges[0].node.title'
-          TAG_MSG=$(jq --raw-output "${PR_QUERY}"  pr.json)
-
-          bump2version --current-version $(git describe --abbrev=0) \
-              --tag --tag-message "${TAG_MSG}" "${BUMP_PART}"
-
-          git push --tags
-          echo "Tagged version $(git describe --abbrev=0) and pushed back to repo"