Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Github Action to create Docker image #392

Merged
merged 6 commits into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# *nix shell scripts always use LF (see .editorconfig)
m-mohr marked this conversation as resolved.
Show resolved Hide resolved
*.sh eol=lf
62 changes: 62 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -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/#-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
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
tschumpr marked this conversation as resolved.
Show resolved Hide resolved

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:
Expand All @@ -257,6 +258,18 @@ To run the container:
docker run -p 8080:8080 stac-browser:v1
```

### Use existing image
tschumpr marked this conversation as resolved.
Show resolved Hide resolved
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.
Expand Down