From 03a49ba21a9cdb824c23e3e6b1453e89dcad58ab Mon Sep 17 00:00:00 2001 From: Thiriot Christophe <doubleface@users.noreply.github.com> Date: Tue, 28 Jul 2020 09:58:30 +0200 Subject: [PATCH] feat: allow konnectors to be run in cozy-app-dev image (#2580) This way, connectors can be run in the cozy-app-dev image without any special setup, but this add 75Mo to the cozy-app-dev image. Another solution would be to create another docker image specific for this goal. Co-authored-by: doubleface <christophe@cozycloud.cc> --- scripts/Dockerfile | 6 ++++++ scripts/cozy-app-dev.sh | 2 ++ scripts/docker-entrypoint.sh | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/Dockerfile b/scripts/Dockerfile index d2e3bcefc..54c1a2137 100644 --- a/scripts/Dockerfile +++ b/scripts/Dockerfile @@ -65,6 +65,11 @@ RUN set -eux; apt-get update \ && mv ./rel/couchdb /usr/local \ && cd / \ && rm -rf /usr/src/couchdb \ + && curl -fsSL --compressed https://nodejs.org/dist/v12.9.1/node-v12.9.1-linux-x64.tar.xz \ + && tar -xJf "node-v12.9.1-linux-x64.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \ + && rm "node-v12.9.1-linux-x64.tar.xz" \ + && ln -s /usr/local/bin/node /usr/local/bin/nodejs \ + && node --version \ # Cleanup && apt-get purge -y \ build-essential \ @@ -82,6 +87,7 @@ COPY --from=build \ /app/cozy-stack \ /app/scripts/docker-entrypoint.sh \ /app/scripts/cozy-app-dev.sh \ + /app/scripts/konnector-node-run.sh \ /app/MailHog \ /usr/bin/ diff --git a/scripts/cozy-app-dev.sh b/scripts/cozy-app-dev.sh index f6f139252..5dc70e284 100755 --- a/scripts/cozy-app-dev.sh +++ b/scripts/cozy-app-dev.sh @@ -8,6 +8,7 @@ set -m [ -z "${COZY_STACK_PASS}" ] && COZY_STACK_PASS="cozy" [ -z "${COZY_STACK_ADMIN_PORT}" ] && COZY_STACK_ADMIN_PORT="6060" [ -z "${COUCHDB_URL}" ] && COUCHDB_URL="http://localhost:5984/" +[ -n "${COZY_KONNECTORS_CMD}" ] && COZY_KONNECTORS_CMD_OPTION="--konnectors-cmd $COZY_KONNECTORS_CMD" if [ -d "${COZY_STACK_PATH}" ] && [ -f "${COZY_STACK_PATH}/cozy-stack" ]; then COZY_STACK_PATH="${COZY_STACK_PATH}/cozy-stack" @@ -109,6 +110,7 @@ do_start() { --admin-port "${COZY_STACK_ADMIN_PORT}" \ --couchdb-url "${COUCHDB_URL}" \ --mailhog \ + ${COZY_KONNECTORS_CMD_OPTION} \ --fs-url "file://localhost${vfsdir}" & wait_for "${COZY_STACK_HOST}:${COZY_STACK_PORT}/version/" "cozy-stack" diff --git a/scripts/docker-entrypoint.sh b/scripts/docker-entrypoint.sh index 807044f87..226da8743 100755 --- a/scripts/docker-entrypoint.sh +++ b/scripts/docker-entrypoint.sh @@ -26,6 +26,6 @@ else fi fi -/usr/bin/cozy-app-dev.sh \ +COZY_KONNECTORS_CMD="/usr/bin/konnector-node-run.sh" /usr/bin/cozy-app-dev.sh \ -d "${appdir}" \ -f /data/cozy-storage -- GitLab