From 3c2348d8f9edd8b940b9529e35c54ed6eb47ca1e Mon Sep 17 00:00:00 2001 From: tschumpr Date: Thu, 23 Nov 2023 14:21:13 +0100 Subject: [PATCH 1/5] Add action to build image on release --- .github/workflows/publish.yml | 62 +++++++++++++++++++++++++++++++++++ README.md | 13 ++++++++ 2 files changed, 75 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 000000000..334c242de --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,62 @@ +name: Publish + +on: + release: + types: [released] + workflow_dispatch: + inputs: + TAG_NAME: + description: "Tag name" + required: true + +env: + REGISTRY: ghcr.io + TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }} + +jobs: + retag-docker-image: + runs-on: ubuntu-latest + name: Push updated Docker image + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set environment variables + run: | + echo VERSION=${TAG_NAME#v} >> $GITHUB_ENV + echo IMAGE_NAME=$REGISTRY/$(echo ${GITHUB_REPOSITORY,,}) >> $GITHUB_ENV + echo COMMITED_AT=$(git show -s --format=%cI `git rev-parse HEAD`) >> $GITHUB_ENV + echo REVISION=$(git rev-parse --short HEAD) >> $GITHUB_ENV + + - name: Collect Docker image metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE_NAME }} + labels: | + org.opencontainers.image.created=${{ env.COMMITED_AT }} + org.opencontainers.image.version=v${{ env.VERSION }} + org.opencontainers.image.maintainer=$({github.repository_owner}) + tags: | + type=semver,pattern={{version}},value=v${{ env.VERSION }} + + - name: Log in to the GitHub container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: true + build-args: | + VERSION=${{ env.VERSION }} + REVISION=${{ env.REVISION }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:edge + cache-to: type=inline diff --git a/README.md b/README.md index e6cde48ea..38cc36cf1 100644 --- a/README.md +++ b/README.md @@ -241,6 +241,7 @@ STAC Browser supports some non-standardized extensions to the STAC specification 2. A link with relation type `icon` and a Browser-supported media type in any STAC entity will show an icon in the header and the lists. ## Docker +### Create custom image When building the Dockerfile, you can add the [`catalogUrl`](docs/options.md#catalogurl) as a [build argument](https://docs.docker.com/engine/reference/commandline/build/#set-build-time-variables---build-arg). For example: @@ -257,6 +258,18 @@ To run the container: docker run -p 8080:8080 stac-browser:v1 ``` +### Use existing image +You can add an existing image from [Packages](https://github.com/radiantearth/stac-browser/pkgs/container/stac-browser) to your docker-compose.yml: +``` +services: + stac-browser: + image: ghcr.io/radiantearth/stac-browser:latest + ports: + - 8080:8080 + environment: + SB_catalogUrl: "https://localhost:7188" +``` + ## Contributing We are happy to review and accept Pull Requests. From ab29bf77ef9411e3e476f5def3cc8ff3633e90de Mon Sep 17 00:00:00 2001 From: tschumpr Date: Thu, 23 Nov 2023 14:26:25 +0100 Subject: [PATCH 2/5] Add gitattributes for correct checkout on windows --- .gitattributes | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..79f1111aa --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# *nix shell scripts always use LF (see .editorconfig) +*.sh eol=lf \ No newline at end of file From 84f12565b85bca8df13e42bc5e65ee7b12413095 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roswita=20Tsch=C3=BCmperlin?= <108136714+tschumpr@users.noreply.github.com> Date: Mon, 15 Jan 2024 09:08:03 +0100 Subject: [PATCH 3/5] Update README.md Co-authored-by: Matthias Mohr --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 38cc36cf1..bd3ceae23 100644 --- a/README.md +++ b/README.md @@ -258,7 +258,8 @@ To run the container: docker run -p 8080:8080 stac-browser:v1 ``` -### Use existing image +### Use an existing image + You can add an existing image from [Packages](https://github.com/radiantearth/stac-browser/pkgs/container/stac-browser) to your docker-compose.yml: ``` services: From 3a9ca0c9c0fd4c3d14192419e830361425cb565f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roswita=20Tsch=C3=BCmperlin?= <108136714+tschumpr@users.noreply.github.com> Date: Mon, 15 Jan 2024 09:08:13 +0100 Subject: [PATCH 4/5] Update README.md Co-authored-by: Matthias Mohr --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bd3ceae23..dfcf93495 100644 --- a/README.md +++ b/README.md @@ -241,7 +241,8 @@ STAC Browser supports some non-standardized extensions to the STAC specification 2. A link with relation type `icon` and a Browser-supported media type in any STAC entity will show an icon in the header and the lists. ## Docker -### Create custom image + +### Create a custom image When building the Dockerfile, you can add the [`catalogUrl`](docs/options.md#catalogurl) as a [build argument](https://docs.docker.com/engine/reference/commandline/build/#set-build-time-variables---build-arg). For example: From 3ce6fd00f8e11f4db838bf6a87cd1ae3cb56b8c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roswita=20Tsch=C3=BCmperlin?= <108136714+tschumpr@users.noreply.github.com> Date: Mon, 15 Jan 2024 16:16:20 +0100 Subject: [PATCH 5/5] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index d77b0c187..a2165e9ef 100644 --- a/README.md +++ b/README.md @@ -246,7 +246,6 @@ STAC Browser supports some non-standardized extensions to the STAC specification Building the Dockerfile without changing any build options: - ```bash docker build -t stac-browser:v1 . ```