From 6539029d2af525c441210dc5c34ecea6dff1c533 Mon Sep 17 00:00:00 2001 From: Andreas Gebhardt Date: Tue, 7 May 2024 14:30:58 +0200 Subject: [PATCH] fix: docker build of Excalidraw app (#7430) * fix: docker build of Excalidraw app Fixes #7403. * deps: update (container) Nginx to 1.24 --------- Co-authored-by: Aakansha Doshi --- .dockerignore | 7 +++++++ Dockerfile | 12 +++++++----- package.json | 6 +++--- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/.dockerignore b/.dockerignore index 1f38a978cf..8f757e5054 100644 --- a/.dockerignore +++ b/.dockerignore @@ -4,8 +4,15 @@ !.eslintrc.json !.npmrc !.prettierrc +!excalidraw-app/ !package.json !public/ !packages/ !tsconfig.json !yarn.lock + +# keep (sub)sub directories at the end to exclude from explicit included +# e.g. ./packages/excalidraw/{dist,node_modules} +**/build +**/dist +**/node_modules diff --git a/Dockerfile b/Dockerfile index a044f40f64..31487e2873 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,16 +2,18 @@ FROM node:18 AS build WORKDIR /opt/node_app -COPY package.json yarn.lock ./ -RUN yarn --ignore-optional --network-timeout 600000 +COPY . . + +# do not ignore optional dependencies: +# Error: Cannot find module @rollup/rollup-linux-x64-gnu +RUN yarn --network-timeout 600000 ARG NODE_ENV=production -COPY . . RUN yarn build:app:docker -FROM nginx:1.21-alpine +FROM nginx:1.24-alpine -COPY --from=build /opt/node_app/build /usr/share/nginx/html +COPY --from=build /opt/node_app/excalidraw-app/build /usr/share/nginx/html HEALTHCHECK CMD wget -q -O /dev/null http://localhost || exit 1 diff --git a/package.json b/package.json index 1dcd51a19e..50e210b3ff 100644 --- a/package.json +++ b/package.json @@ -60,9 +60,9 @@ "prettier": "@excalidraw/prettier-config", "scripts": { "build-node": "node ./scripts/build-node.js", - "build:app:docker": "cross-env VITE_APP_DISABLE_SENTRY=true VITE_APP_DISABLE_TRACKING=true vite build", - "build:app": "cross-env VITE_APP_GIT_SHA=$VERCEL_GIT_COMMIT_SHA vite build", - "build:version": "node ./scripts/build-version.js", + "build:app:docker": "yarn --cwd ./excalidraw-app build:app:docker", + "build:app": "yarn --cwd ./excalidraw-app build:app", + "build:version": "yarn --cwd ./excalidraw-app build:version", "build": "yarn --cwd ./excalidraw-app build", "fix:code": "yarn test:code --fix", "fix:other": "yarn prettier --write",