From b6dde69c4f8b52fa4928242d5b04d9c203f64c65 Mon Sep 17 00:00:00 2001 From: Cameron Diver Date: Wed, 8 Apr 2020 09:36:07 +0100 Subject: [PATCH] Link sqlite with a system sqlite for quicker builds Change-type: patch Signed-off-by: Cameron Diver --- Dockerfile | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 87168be8..0266d4c8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,7 +30,9 @@ RUN apk add --no-cache \ binutils \ libgcc \ libstdc++ \ - libuv + libuv \ + sqlite-libs \ + sqlite-dev COPY build-conf/node-sums.txt . @@ -43,7 +45,7 @@ RUN curl -SLO "${NODE_LOCATION}" \ COPY package*.json ./ -RUN npm ci +RUN npm ci --build-from-source --sqlite=/usr/lib # TODO: Once we support live copies and live runs, convert # these @@ -62,23 +64,23 @@ RUN npm run test-nolint \ # Run the production install here, to avoid the npm dependency on # the later stage -RUN npm ci --production --no-optional --unsafe-perm \ +RUN npm ci --production --no-optional --unsafe-perm --build-from-source --sqlite=/usr/lib \ && npm cache clean --force \ # For some reason this doesn't get cleared with the other # cache && rm -rf node_modules/.cache \ # Remove various uneeded filetypes in order to reduce space # We also remove the spurious node.dtps, see https://github.com/mapbox/node-sqlite3/issues/861 - && find . -path '*/coverage/*' -o -path '*/test/*' -o -path '*/.nyc_output/*' \ - -o -name '*.tar.*' -o -name '*.in' -o -name '*.cc' \ - -o -name '*.c' -o -name '*.coffee' -o -name '*.eslintrc' \ - -o -name '*.h' -o -name '*.html' -o -name '*.markdown' \ - -o -name '*.md' -o -name '*.patch' -o -name '*.png' \ - -o -name '*.yml' -o -name "*.ts" \ - -delete \ - && find . -type f -path '*/node_modules/sqlite3/deps*' -delete \ - && find . -type f -path '*/node_modules/knex/build*' -delete \ - && rm -rf node_modules/sqlite3/node.dtps + && find . -path '*/coverage/*' -o -path '*/test/*' -o -path '*/.nyc_output/*' \ + -o -name '*.tar.*' -o -name '*.in' -o -name '*.cc' \ + -o -name '*.c' -o -name '*.coffee' -o -name '*.eslintrc' \ + -o -name '*.h' -o -name '*.html' -o -name '*.markdown' \ + -o -name '*.md' -o -name '*.patch' -o -name '*.png' \ + -o -name '*.yml' -o -name "*.ts" \ + -delete \ + && find . -type f -path '*/node_modules/sqlite3/deps*' -delete \ + && find . -type f -path '*/node_modules/knex/build*' -delete \ + && rm -rf node_modules/sqlite3/node.dtps # RUN ["cross-build-end"] @@ -95,7 +97,8 @@ RUN apk add --no-cache \ rsync \ avahi \ dbus \ - libstdc++ + libstdc++ \ + sqlite-libs WORKDIR /usr/src/app