sqlchat / sqlchat

Chat-based SQL Client and Editor for the next decade

Home Page:https://sqlchat.ai

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

docker build fail

dolphinsboy opened this issue · comments

Describe the bug

docker

docker build -f Dockerfile .

fail

controlplane $ docker build -f Dockerfile .
Sending build context to Docker daemon  757.2kB
Step 1/23 : FROM node:18-alpine AS base
 ---> 6f44d13dd258
Step 2/23 : FROM base AS deps
 ---> 6f44d13dd258
Step 3/23 : RUN apk add --no-cache libc6-compat
 ---> Using cache
 ---> affc55441cd0
Step 4/23 : WORKDIR /app
 ---> Using cache
 ---> 9f88824587e2
Step 5/23 : COPY package.json pnpm-lock.yaml* ./
 ---> Using cache
 ---> 54a3b16a8297
Step 6/23 : RUN yarn global add pnpm && pnpm i --frozen-lockfile
 ---> Using cache
 ---> 6b79292d428e
Step 7/23 : FROM base AS builder
 ---> 6f44d13dd258
Step 8/23 : WORKDIR /app
 ---> Using cache
 ---> a34ba94dcf05
Step 9/23 : COPY --from=deps /app/node_modules ./node_modules
 ---> Using cache
 ---> c5746f7295e1
Step 10/23 : COPY . .
 ---> Using cache
 ---> 2c0423a4e011
Step 11/23 : RUN yarn run docker-build
 ---> Running in cd9ce44845e1
yarn run v1.22.19
$ prisma generate && prisma migrate deploy && next build
Prisma schema loaded from prisma/schema.prisma

✔ Generated Prisma Client (4.13.0 | library) to ./node_modules/.pnpm/@prisma+client@4.13.0_prisma@4.13.0/node_modules/@prisma/client in 101ms
You can now start using Prisma Client in your code. Reference: https://pris.ly/d/client

import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()

Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database

Error: Prisma schema validation - (get-config wasm)
Error code: P1012
error: Environment variable not found: USAGE_DATABASE_URL.
  -->  schema.prisma:10
   | 
 9 |   provider = "postgresql"
10 |   url      = env("USAGE_DATABASE_URL")
   | 

Validation Error Count: 1
[Context: getConfig]

Prisma CLI Version : 4.13.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
The command '/bin/sh -c yarn run docker-build' returned a non-zero code: 1

To reproduce

docker build -f Dockerfile .

Additional context

No response

find save issue, when use pnpm dev, it does appear,
major info may as below:
#15 18.59 ./prisma/seed.ts:6:24
#15 18.59 Type error: Namespace '"/app/node_modules/.pnpm/@prisma+client@4.13.0_prisma@4.13.0/node_modules/.prisma/client/index".Prisma' has no exported member 'ChatCreateInput'.
#15 18.59
#15 18.59 4 | const prisma = new PrismaClient();
#15 18.59 5 |
#15 18.59 > 6 | const chatData: Prisma.ChatCreateInput[] = [
#15 18.59 | ^
#15 18.59 7 | {
#15 18.59 8 | id: uuidv4(),
#15 18.59 9 | createdAt: new Date(),
#15 18.69 error Command failed with exit code 1.
#15 18.69 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

executor failed running [/bin/sh -c yarn build]: exit code: 1

need a postgresql instance,modify Dockerfile add one line:

COPY --from=deps /app/node_modules ./node_modules
COPY . .

ENV USAGE_DATABASE_URL postgresql://sqlchat:sqlchat@10.10.XXX:5432/sample_employee?schema=sample_employee

RUN yarn run docker-build