Skip to content

Commit

Permalink
feat: Publish Docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeboer committed Jun 26, 2024
1 parent f156140 commit ebba9f9
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 2 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Publish Docker image

on:
release:
types: [published]

permissions:
contents: read

jobs:
push_to_registry:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
- uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v5
id: meta
with:
images: ghcr.io/${{ github.repository }}
- uses: docker/build-push-action@v5
id: push
with:
context: .
file: docker/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.output.labels }}
- uses: actions/attest-build-provenance@v1
with:
subject-name: ghcr.io/${{ github.repository }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,24 @@ so users will not be locked into a proprietary tool or technology.

## Usage

To get started with LD Workbench, first install [NodeJS](https://nodejs.org), then run:
To get started with LD Workbench, you can either use the NPM package or a Docker image.

To use the NPM package, install [Node.js](https://nodejs.org), then run:

```sh
npx @netwerk-digitaal-erfgoed/ld-workbench@latest --init
````

Alternatively, to run the Docker image,
first create a directory to store your pipeline configurations,
then run the Docker image (mounting the `pipelines/` directory with `-v` and using `-t` for colorful console output):

```sh
mkdir pipelines
docker run -t -v $(pwd)/pipelines:/pipelines ghcr.io/netwerk-digitaal-erfgoed/ld-workbench:latest
```


This creates an example LD Workbench pipeline in the `pipelines/configurations/example` directory
and runs that pipeline right away. The output is written to `pipelines/data`.

Expand All @@ -61,7 +73,9 @@ You can find more examples in the [ld-workbench-configuration](https://github.co

#### Iterator

Each stage has a single iterator. The iterator SPARQL SELECT query must return a `$this` binding for each URI that will be passed to the generator(s).
Each stage has a single iterator.
The iterator selects URIs from a dataset that match certain criteria.
The iterator SPARQL SELECT query must return a `$this` binding for each URI that will be passed to the generator(s).

The query can be specified either inline:

Expand Down
8 changes: 8 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM node:lts-alpine AS build

RUN npm install -g @netwerk-digitaal-erfgoed/ld-workbench@latest \
&& npm cache clean --force

COPY docker/entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
USER node
7 changes: 7 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

if [ -d "/pipelines/configurations/example" ]; then
ld-workbench $@
else
ld-workbench --init
fi

0 comments on commit ebba9f9

Please sign in to comment.