anse-app/chatgpt-demo

docker build images error

xiangyu123 opened this issue · 1 comments

How is Anse deployed?

Node

Describe the bug

git clone https://github.com/anse-app/chatgpt-demo.git
cd chatgpt-demo
docker build -t chatgpt-demo-image .

Console Logs

[+] Building 10.2s (11/15)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 479B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 137B 0.0s
=> [internal] load metadata for docker.io/library/node:alpine 1.7s
=> [internal] load build context 0.0s
=> => transferring context: 4.38kB 0.0s
=> [builder 1/7] FROM docker.io/library/node:alpine@sha256:d75175d449921d06250afd87d51f39a74fc174789fa3c50eba0d3b18369cc749 0.0s
=> CACHED [builder 2/7] WORKDIR /usr/src 0.0s
=> CACHED [builder 3/7] RUN npm install -g pnpm 0.0s
=> CACHED [builder 4/7] COPY package.json pnpm-lock.yaml ./ 0.0s
=> CACHED [builder 5/7] RUN pnpm install 0.0s
=> CACHED [builder 6/7] COPY . . 0.0s
=> ERROR [builder 7/7] RUN pnpm run build 8.5s

[builder 7/7] RUN pnpm run build:
#0 0.813
#0 0.813 > chatgpt-api-demo@0.0.1 build /usr/src
#0 0.813 > astro build
#0 0.813
#0 3.248 07:31:12 AM [content] No content directory found. Skipping type generation.
#0 3.249 07:31:12 AM [build] output target: server
#0 3.250 07:31:12 AM [build] deploy adapter: @astrojs/node
#0 3.250 07:31:12 AM [build] Collecting build info...
#0 3.251 07:31:12 AM [build] Completed in 697ms.
#0 3.252 07:31:12 AM [build] Building server entrypoints...
#0 7.903 [vite-plugin-pwa:build] [vite]: Rollup failed to resolve import "@unocss/reset/tailwind.css" from "astro:scripts/page-ssr.js".
#0 7.903 This is most likely unintended because it can break your application at runtime.
#0 7.903 If you do want to externalize this module explicitly add it to
#0 7.903 build.rollupOptions.external
#0 8.375 error [vite]: Rollup failed to resolve import "@unocss/reset/tailwind.css" from "astro:scripts/page-ssr.js".
#0 8.375 This is most likely unintended because it can break your application at runtime.
#0 8.375 If you do want to externalize this module explicitly add it to
#0 8.375 build.rollupOptions.external
#0 8.375 File:
#0 8.375 /usr/src/node_modules/.pnpm/vite@4.3.9/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:46597:23
#0 8.375 Code:
#0 8.375 46596 | if (!id || !/?commonjs-external$/.test(id)) {
#0 8.375 > 46597 | throw new Error([vite]: Rollup failed to resolve import "${exporter}" from "${id}".\n +
#0 8.375 | ^
#0 8.375 46598 | This is most likely unintended because it can break your application at runtime.\n +
#0 8.375 46599 | If you do want to externalize this module explicitly add it to\n +
#0 8.375 46600 | \build.rollupOptions.external`); #0 8.375 Stacktrace: #0 8.375 Error: [vite]: Rollup failed to resolve import "@unocss/reset/tailwind.css" from "astro:scripts/page-ssr.js". #0 8.375 This is most likely unintended because it can break your application at runtime. #0 8.375 If you do want to externalize this module explicitly add it to #0 8.375 build.rollupOptions.external`
#0 8.375 at viteWarn (file:///usr/src/node_modules/.pnpm/vite@4.3.9/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:46597:23)
#0 8.375 at onRollupWarning (file:///usr/src/node_modules/.pnpm/vite@4.3.9/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:46621:9)
#0 8.375 at onwarn (file:///usr/src/node_modules/.pnpm/vite@4.3.9/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:46368:13)
#0 8.375 at file:///usr/src/node_modules/.pnpm/rollup@3.25.1/node_modules/rollup/dist/es/shared/node-entry.js:23639:13
#0 8.375 at Object.logger [as onLog] (file:///usr/src/node_modules/.pnpm/rollup@3.25.1/node_modules/rollup/dist/es/shared/node-entry.js:25305:9)
#0 8.375 at ModuleLoader.handleInvalidResolvedId (file:///usr/src/node_modules/.pnpm/rollup@3.25.1/node_modules/rollup/dist/es/shared/node-entry.js:24221:26)
#0 8.375 at file:///usr/src/node_modules/.pnpm/rollup@3.25.1/node_modules/rollup/dist/es/shared/node-entry.js:24181:26
#0 8.375
#0 8.396  ELIFECYCLE  Command failed with exit code 1.


Dockerfile:7

5 | RUN pnpm install
6 | COPY . .
7 | >>> RUN pnpm run build
8 |
9 | FROM node:alpine

ERROR: failed to solve: process "/bin/sh -c pnpm run build" did not complete successfully: exit code: 1

Participation

  • I am willing to submit a pull request for this issue.
rudism commented

I'm having the same problem. It seem like maybe something to do with the use of pnpm, because when I replace all of the RUN pnpm install and RUN pnpm run build lines in the Dockerfile with RUN npm install and RUN npm run build then the image builds fine.