Skip to content

Commit b36881b

Browse files
authored
Merge pull request #3 from frafra/docker
Dockerize OpenRefine
2 parents 6a6de77 + 39d9083 commit b36881b

File tree

5 files changed

+157
-0
lines changed

5 files changed

+157
-0
lines changed

.github/workflows/docker.yaml

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Docker
2+
3+
on:
4+
push:
5+
branches: [ 'main' ]
6+
pull_request:
7+
branches: [ 'main' ]
8+
schedule:
9+
- cron: "0 0 * * 1"
10+
11+
env:
12+
REGISTRY: ghcr.io
13+
IMAGE_NAME: ${{ github.repository }}
14+
15+
jobs:
16+
docker:
17+
runs-on: ubuntu-latest
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
include:
22+
- version: "master"
23+
- version: "4.0"
24+
- version: "3.7"
25+
- version: "3.7.5"
26+
- version: "3.6.2"
27+
permissions:
28+
contents: read
29+
packages: write
30+
steps:
31+
-
32+
name: Set up Docker Buildx
33+
uses: docker/setup-buildx-action@v2
34+
-
35+
name: Checkout
36+
uses: actions/checkout@v3
37+
-
38+
name: Login to registry
39+
if: github.event_name != 'pull_request'
40+
uses: docker/login-action@v2
41+
with:
42+
registry: ${{ env.REGISTRY }}
43+
username: ${{ github.actor }}
44+
password: ${{ secrets.GITHUB_TOKEN }}
45+
-
46+
name: Extract Docker metadata
47+
id: meta
48+
uses: docker/metadata-action@v4
49+
with:
50+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
51+
tags: ${{ matrix.version }}
52+
-
53+
name: Build and push container
54+
uses: docker/build-push-action@v3
55+
with:
56+
cache-from: type=gha
57+
cache-to: type=gha,mode=max
58+
push: ${{ github.event_name != 'pull_request' }}
59+
build-args: VERSION=${{ matrix.version }}
60+
tags: ${{ steps.meta.outputs.tags }}
61+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
FROM registry.opensuse.org/opensuse/git:latest AS sources
2+
ARG VERSION=master
3+
WORKDIR /opt/openrefine
4+
RUN git clone https://github.com/OpenRefine/OpenRefine.git --depth 1 --branch $VERSION .
5+
6+
FROM registry.opensuse.org/opensuse/bci/openjdk-devel:latest AS backend
7+
WORKDIR /opt/openrefine
8+
COPY --from=sources /opt/openrefine .
9+
RUN --mount=type=cache,target=/root/.m2 \
10+
mvn -B process-resources compile test-compile
11+
12+
FROM registry.opensuse.org/opensuse/bci/nodejs:latest AS frontend
13+
WORKDIR /opt/openrefine/main/webapp
14+
COPY --from=sources /opt/openrefine/main/webapp .
15+
RUN --mount=type=cache,target=/root/.npm \
16+
npm install
17+
18+
FROM registry.opensuse.org/opensuse/bci/openjdk:latest
19+
# which is needed as command by old versions:
20+
# - https://github.com/OpenRefine/OpenRefine/pull/5332
21+
RUN zypper --non-interactive install gettext-tools which
22+
WORKDIR /opt/openrefine
23+
COPY --from=backend /opt/openrefine/server server/
24+
COPY --from=backend /opt/openrefine/main main/
25+
COPY --from=frontend /opt/openrefine/main/webapp/modules main/webapp/modules
26+
COPY --from=backend /opt/openrefine/refine .
27+
COPY entrypoint.sh refine.ini.template ./
28+
29+
EXPOSE 3333/TCP
30+
ENV REFINE_MEMORY=1400M
31+
ENV REFINE_MIN_MEMORY=1400M
32+
33+
HEALTHCHECK --start-period=10s CMD curl -sSf -o /dev/null http://localhost:3333
34+
35+
ENTRYPOINT ["/bin/sh", "entrypoint.sh"]
36+
CMD ["/opt/openrefine/refine", "-i", "0.0.0.0", "-d", "/workspace", "run"]

docker-compose.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: "3.4"
2+
services:
3+
openrefine:
4+
build:
5+
context: .
6+
dockerfile: Dockerfile
7+
args:
8+
VERSION: master
9+
environment:
10+
REFINE_MEMORY: 2000M
11+
REFINE_MIN_MEMORY: 2000M
12+
ports:
13+
- 3333:3333

entrypoint.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
set -xeuo pipefail
4+
5+
template="refine.ini.template"
6+
7+
if [ -f "$template" ]
8+
then
9+
envsubst < "$template" > refine.ini
10+
fi
11+
12+
exec "$@"

refine.ini.template

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# NOTE: This file is not read if you run the Refine executable directly
2+
# It is only read of you use the refine shell script or refine.bat
3+
4+
# FOR DEVELOPERS: you can copy refine.ini and rename it to refine-dev.ini
5+
# Configurations in refine.ini will be ignored if refine-dev.ini exists
6+
# refine-dev.ini won't be tracked by Git, so feel free to put your custom configurations in it
7+
8+
no_proxy="localhost,127.0.0.1"
9+
#REFINE_PORT=3334
10+
#REFINE_HOST=127.0.0.1
11+
#REFINE_WEBAPP=main\webapp
12+
13+
# Maximum JVM heap (memory) and max form size allocations
14+
#REFINE_MAX_FORM_CONTENT_SIZE=1048576
15+
REFINE_MEMORY=${REFINE_MEMORY}
16+
17+
# Initial (and minimum) size of Java heap
18+
REFINE_MIN_MEMORY=${REFINE_MIN_MEMORY}
19+
20+
# Some sample configurations. These have no defaults.
21+
#JAVA_HOME=C:\Program Files\Java\jdk1.8.0_151
22+
# Use a single JAVA_OPTIONS that includes any JVM options you need upon OpenRefine startup
23+
#JAVA_OPTIONS=-XX:+UseParallelGC -verbose:gc -Drefine.headless=true -Drefine.data_dir=C:\Users\user\AppData\Roaming\OpenRefine -Drefine.display.new.version.notice=true
24+
25+
# Uncomment to increase autosave period to 60 mins (default: 5 minutes)
26+
# for better performance of long-lasting transformations (but increased risk of data loss)
27+
#REFINE_AUTOSAVE_PERIOD=60
28+
29+
# Google Data OAuth configuration for developers
30+
# (NOTE: This is only needed for developers. Users of released versions can ignore this)
31+
# To get your credentials, please see the instructions on the wiki:
32+
# https://github.com/OpenRefine/OpenRefine/wiki/Google-Extension
33+
#GDATA_CLIENT_ID=your_client_id
34+
#GDATA_CLIENT_SECRET=your_client_secret
35+
#GDATA_API_KEY=your API key

0 commit comments

Comments
 (0)