From 8d74e9eb55b1e530d3ac245ec6f10de6e4ce2a54 Mon Sep 17 00:00:00 2001 From: Francesco Frassinelli Date: Tue, 19 Sep 2023 21:28:35 +0200 Subject: [PATCH] Build openrefine from sources --- .github/workflows/docker.yaml | 11 +++++++---- Dockerfile | 28 +++++++++++++++++++++------- docker-compose.yml | 4 +++- 3 files changed, 31 insertions(+), 12 deletions(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 87f0bf3..d39cfb5 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -17,8 +17,11 @@ jobs: fail-fast: false matrix: include: - - build_args: version=3.7.5 - tag: 3.7.5 + - version: "master" + - version: "4.0" + - version: "3.7" + - version: "3.7.5" + - version: "3.6.2" permissions: contents: read packages: write @@ -43,7 +46,7 @@ jobs: uses: docker/metadata-action@v4 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: ${{ matrix.tag }} + tags: ${{ matrix.version }} - name: Build and push container uses: docker/build-push-action@v3 @@ -51,6 +54,6 @@ jobs: cache-from: type=gha cache-to: type=gha,mode=max push: ${{ github.event_name != 'pull_request' }} - build-args: ${{ matrix.build_args }} + build-args: VERSION=${{ matrix.version }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile index 39743eb..4800db7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,28 @@ -FROM quay.io/centos/centos:stream9-minimal as base -ARG VERSION=3.7.5 +FROM registry.opensuse.org/opensuse/git:latest AS sources +ARG VERSION=master +WORKDIR /opt/openrefine +RUN git clone https://github.com/OpenRefine/OpenRefine.git --depth 1 --branch $VERSION . -RUN microdnf install --assumeyes --setopt=install_weak_deps=0 java-17-openjdk-headless procps which gettext tar gzip +FROM registry.opensuse.org/opensuse/bci/openjdk-devel:latest AS backend WORKDIR /opt/openrefine -RUN curl -L https://github.com/OpenRefine/OpenRefine/releases/download/$VERSION/openrefine-linux-$VERSION.tar.gz | \ - tar xz --strip-components 1 -COPY entrypoint.sh refine.ini.template LICENSE.txt . +COPY --from=sources /opt/openrefine . +RUN --mount=type=cache,target=/root/.m2 \ + mvn -B package -P linux -DskipTests=true -Dmaven.antrun.skip=true -EXPOSE 3333/TCP +FROM registry.opensuse.org/opensuse/bci/nodejs:latest AS frontend +WORKDIR /opt/openrefine/main/webapp +COPY --from=sources /opt/openrefine/main/webapp . +RUN --mount=type=cache,target=/root/.npm \ + npm install +FROM registry.opensuse.org/opensuse/bci/openjdk:latest +RUN zypper --non-interactive install gettext-tools +WORKDIR /opt/openrefine +COPY --from=backend /opt/openrefine . +COPY --from=frontend /opt/openrefine/main/webapp/modules main/webapp/modules +COPY entrypoint.sh refine.ini.template ./ + +EXPOSE 3333/TCP ENV REFINE_MEMORY=1400M ENV REFINE_MIN_MEMORY=1400M diff --git a/docker-compose.yml b/docker-compose.yml index d15ddcd..65b2459 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,6 +3,8 @@ services: build: context: . dockerfile: Dockerfile + args: + VERSION: master environment: REFINE_MEMORY: 2000M REFINE_MIN_MEMORY: 2000M @@ -17,7 +19,7 @@ services: timeout: 10s interval: 1m0s retries: 5 - image: ghcr.io/ninanor/openrefine:main + image: ghcr.io/ninanor/openrefine:master networks: default: null ports: