From 1c6ad2b7db9361578384733c5c235d84de5911be Mon Sep 17 00:00:00 2001 From: Simon Detheridge Date: Wed, 12 Feb 2020 15:37:32 +0000 Subject: [PATCH] Merge pull request #2569 from overleaf/as-build-changes Build changes required for passing secrets into docker build GitOrigin-RevId: 46c221bd0f0e3ec4ec02384afb252c532d688516 --- services/web/.dockerignore | 7 +++++++ services/web/Dockerfile | 14 +++++++++++--- services/web/install_deps.sh | 10 ---------- 3 files changed, 18 insertions(+), 13 deletions(-) create mode 100644 services/web/.dockerignore diff --git a/services/web/.dockerignore b/services/web/.dockerignore new file mode 100644 index 0000000000..95538e3f9b --- /dev/null +++ b/services/web/.dockerignore @@ -0,0 +1,7 @@ +**/node_modules +copybara +data +public/js +public/minjs +public/stylesheets +public/manifest.json diff --git a/services/web/Dockerfile b/services/web/Dockerfile index 4ab3a43537..68b88560c9 100644 --- a/services/web/Dockerfile +++ b/services/web/Dockerfile @@ -7,20 +7,28 @@ WORKDIR /app FROM base as app -#wildcard as some files may not be in all repos COPY package.json package-lock.json /app/ RUN npm install --quiet - COPY . /app +RUN chmod 0755 ./install_deps.sh && ./install_deps.sh + FROM base COPY --from=app /app /app WORKDIR /app -RUN chmod 0755 ./install_deps.sh && ./install_deps.sh + +RUN mkdir -p /app/data/dumpFolder && \ + mkdir -p /app/data/logs && \ + mkdir -p /app/data/pdf && \ + mkdir -p /app/data/uploads && \ + mkdir -p /app/data/zippedProjects && \ + chmod -R 0755 /app/data/ && \ + chown -R node:node /app/data/ + USER node CMD ["node", "--expose-gc", "app.js"] diff --git a/services/web/install_deps.sh b/services/web/install_deps.sh index cfc546c755..9531c7a411 100755 --- a/services/web/install_deps.sh +++ b/services/web/install_deps.sh @@ -12,13 +12,3 @@ wait $LINT && echo "Lint complete" || exit 1 wait $FORMAT && echo "Format complete" || exit 1 wait $TRANSLATIONS && echo "Translations install complete" || exit 1 wait $WEBPACK && echo "Webpack complete" || exit 1 - -chmod -R 0755 /app/public -chown -R node:node /app/public - -set -B - -rm -rf /app/data -mkdir -p /app/data/{dumpFolder,logs,pdf,uploads,zippedProjects} -chmod -R 0755 /app/data/ -chown -R node:node /app/data/