From 227f969b5ec871fc058a35ee72d1c589c968edaa Mon Sep 17 00:00:00 2001
From: Bastien Abadie <bastien@nextcairn.com>
Date: Wed, 26 Aug 2020 14:32:21 +0200
Subject: [PATCH] Add Transkribus client to docker builds

---
 Dockerfile        | 10 ++++++++++
 Dockerfile.binary | 10 ++++++++++
 2 files changed, 20 insertions(+)

diff --git a/Dockerfile b/Dockerfile
index 8887025a31..a1343d7c23 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -10,6 +10,8 @@ ARG COMMON_BRANCH=master
 ARG COMMON_ID=9855787
 ARG PONOS_BRANCH=master
 ARG PONOS_ID=10017043
+ARG TRANSKRIBUS_BRANCH=master
+ARG TRANSKRIBUS_ID=11180199
 ARG GITLAB_TOKEN="gaFM7LRa9zy9QMowcUhx"
 
 # Install arkindex-common from private repo
@@ -29,6 +31,14 @@ RUN \
   cd /tmp/ponos && pip install --disable-pip-version-check --no-cache-dir --quiet . && \
   rm -rf /tmp/ponos
 
+# Install transkribus-client from private repo
+RUN \
+  mkdir /tmp/transkribus && \
+  wget --header "PRIVATE-TOKEN: $GITLAB_TOKEN" https://gitlab.com/api/v4/projects/$TRANSKRIBUS_ID/repository/archive.tar.gz?sha=$TRANSKRIBUS_BRANCH -O /tmp/transkribus/archive.tar.gz && \
+  tar --strip-components=1 -xvf /tmp/transkribus/archive.tar.gz -C /tmp/transkribus && \
+  cd /tmp/transkribus && pip install --disable-pip-version-check --no-cache-dir --quiet . && \
+  rm -rf /tmp/transkribus
+
 # Install arkindex and its deps
 # Uses a source archive instead of full local copy to speedup docker build
 COPY --from=build /build/dist/arkindex-*.tar.gz /tmp/arkindex.tar.gz
diff --git a/Dockerfile.binary b/Dockerfile.binary
index 1f9fb3ef15..5bbf38db74 100644
--- a/Dockerfile.binary
+++ b/Dockerfile.binary
@@ -6,6 +6,8 @@ ARG COMMON_BRANCH=master
 ARG COMMON_ID=9855787
 ARG PONOS_BRANCH=master
 ARG PONOS_ID=10017043
+ARG TRANSKRIBUS_BRANCH=master
+ARG TRANSKRIBUS_ID=11180199
 ARG GITLAB_TOKEN="gaFM7LRa9zy9QMowcUhx"
 
 # We build in /usr/share because Django will try to load some files relative to that path
@@ -29,6 +31,13 @@ RUN mkdir /tmp/ponos && \
   tar --strip-components=1 -xvf /tmp/ponos.tar.gz -C /tmp/ponos && \
   mv /tmp/ponos/ponos /usr/share
 
+# Install transkribus-client from private repo
+RUN \
+  mkdir /tmp/transkribus && \
+  wget --header "PRIVATE-TOKEN: $GITLAB_TOKEN" https://gitlab.com/api/v4/projects/$TRANSKRIBUS_ID/repository/archive.tar.gz?sha=$TRANSKRIBUS_BRANCH -O /tmp/transkribus.tar.gz && \
+  tar --strip-components=1 -xvf /tmp/transkribus.tar.gz -C /tmp/transkribus && \
+  mv /tmp/transkribus/transkribus /usr/share
+
 # Build full requirements, removing relative or remote references to arkindex projects
 # Special case for apistar, where we want to keep our own fork
 # Special case for approximate requirements from ponos, where we want to keep the versions specified from this repo
@@ -50,6 +59,7 @@ RUN python -m nuitka \
       --include-package=arkindex \
       --include-package=arkindex_common \
       --include-package=ponos \
+      --include-package=transkribus \
       --show-progress \
       --python-flag=-OO \
       --lto \
-- 
GitLab