excalidraw: Install fail: Self-hosting docker build fail
xhzn@R440:~/ideaProjects/excalidraw$ docker build -t excalidraw/excalidraw .
[+] Building 6.8s (12/13) docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 379B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 171B 0.0s
=> [internal] load metadata for docker.io/library/nginx:1.21-alpine 5.8s
=> [internal] load metadata for docker.io/library/node:18 5.8s
=> CACHED [stage-1 1/2] FROM docker.io/library/nginx:1.21-alpine@sha256:a74534e76ee1121d418fa7394ca930eb67440deda413848bc67c68138535b989 0.0s
=> [build 1/6] FROM docker.io/library/node:18@sha256:c85dc4392f44f5de1d0d72dd20a088a542734445f99bed7aa8ac895c706d370d 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 27.99kB 0.0s
=> CACHED [build 2/6] WORKDIR /opt/node_app 0.0s
=> CACHED [build 3/6] COPY package.json yarn.lock ./ 0.0s
=> CACHED [build 4/6] RUN yarn --ignore-optional --network-timeout 600000 0.0s
=> CACHED [build 5/6] COPY . . 0.0s
=> ERROR [build 6/6] RUN yarn build:app:docker 0.9s
------
> [build 6/6] RUN yarn build:app:docker:
0.428 yarn run v1.22.19
0.457 $ cross-env VITE_APP_DISABLE_SENTRY=true VITE_APP_DISABLE_TRACKING=true vite build
0.738 vite v4.4.2 building for production...
0.750 ✓ 0 modules transformed.
0.750 ✓ built in 10ms
0.751 Could not resolve entry module "index.html".
0.753 error during build:
0.753 RollupError: Could not resolve entry module "index.html".
0.753 at error (file:///opt/node_app/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:2245:30)
0.753 at ModuleLoader.loadEntryModule (file:///opt/node_app/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:24671:20)
0.753 at async Promise.all (index 0)
0.786 error Command failed with exit code 1.
0.786 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
------
Dockerfile:11
--------------------
9 |
10 | COPY . .
11 | >>> RUN yarn build:app:docker
12 |
13 | FROM nginx:1.21-alpine
--------------------
ERROR: failed to solve: process "/bin/sh -c yarn build:app:docker" did not complete successfully: exit code: 1
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 5
- Comments: 15 (2 by maintainers)
Commits related to this issue
- fix: #6839 docker build failed — committed to alswl/excalidraw by alswl 7 months ago
- fix: #6839 docker build failed — committed to alswl/excalidraw by alswl 7 months ago
- fix: #6839 docker build failed — committed to alswl/excalidraw by alswl 7 months ago
i build it successfully after rm
.dockerignoreindex.htmlis required entry point for vite and the template syntax in index.html is ejs. The required vite plugin (vite-plugin-ejs) to transform it to plain HTML is configured invite.config.tswhich wasn’t included in docker context.Raised a PR which fixes the problems in this issue.
The project structure has refactored, we should add these required files to
.dockerignore:I can provide a pull request if you need.
The OP’s log is not complete because he didn’t used the
--progress plainoption. Find below a complete log.Since you also exclude the directory
.gitin.dockerignore, husky has also errors :fatal: not a git repository (or any of the parent directories): .git.I agree with @mikesutton :
.dockerignoreshould be listing… the files to ignore. You’re doing the opposite way.PS : the buil works fine on tag v0.15.0.
Removing .dockerignore worked for me too
Ok digging further…
You are ignoring (by default) node_modules\ folder in the .dockerignore but not rebuilding with yarn install in the dockerfile. So basically there are no modules available in the docker build. Although I did explicitly add a yarn install, but that still didn’t resolve.
However when I DON’T ignore node_modules it works.
Issue is in dockerignore. You are ignoring something that is required. Remove the ‘*’ at the top allows all things in and the build works.
Not ideal but that’s the issue. Any idea what is needed? Probs best to all allow all and say which you want to ignore (which is really the point of dockerignore).
when you run yarn build:app:docker outside of docker - it works, so not sure it is the template issue.