File tree Expand file tree Collapse file tree 4 files changed +29
-11
lines changed Expand file tree Collapse file tree 4 files changed +29
-11
lines changed Original file line number Diff line number Diff line change 1- FROM node:latest
1+ FROM node:lts-alpine AS builder
22WORKDIR /app
33COPY package*.json ./
44RUN npm ci
55COPY . .
6- RUN [ "npm" , "run" , "prisma:generate" ]
6+ RUN npm run prisma:generate
7+ RUN npm run build
8+
9+ FROM node:lts-alpine AS production
10+ WORKDIR /app
11+ RUN chown -R node:node /app
12+
13+ COPY --chown=node:node package*.json ./
14+ RUN npm ci --omit=dev
15+
16+ COPY --from=builder --chown=node:node /app/build ./build
17+ COPY --from=builder --chown=node:node /app/generated ./generated
18+ COPY --from=builder --chown=node:node /app/prisma ./prisma
19+
20+ USER node
721
8- RUN [ "npm" , "run" , "build" ]
922EXPOSE 3000
10- CMD [ "npm" , "run" , "docker-start" ]
23+
24+ CMD [ "sh" , "-c" , "npm run prisma:migrate:deploy && npm run start" ]
Original file line number Diff line number Diff line change @@ -8,10 +8,11 @@ services:
88 environment :
99 DATABASE_URL : postgresql://postgres:letmein@db:5432/postgres?schema=public
1010 depends_on :
11- - db
11+ db :
12+ condition : service_healthy
1213
1314 db :
14- image : postgres:latest
15+ image : postgres:alpine
1516 environment :
1617 POSTGRES_USER : postgres
1718 POSTGRES_PASSWORD : letmein
@@ -20,6 +21,11 @@ services:
2021 - " 5432:5432"
2122 volumes :
2223 - fs_data:/var/lib/postgresql/data
24+ healthcheck :
25+ test : ["CMD-SHELL", "pg_isready -U postgres"]
26+ interval : 5s
27+ timeout : 5s
28+ retries : 5
2329
2430volumes :
2531 fs_data:
Original file line number Diff line number Diff line change 2020 "prisma:seed" : " prisma db seed" ,
2121 "test:prisma:migrate:deploy" : " dotenv -e .env.test -- prisma migrate deploy" ,
2222 "test:e2e" : " playwright test" ,
23- "test:prisma:seed" : " dotenv -e .env.test prisma db seed" ,
24- "docker-start" : " npm run prisma:migrate:deploy && npm run prisma:seed && npm run start"
23+ "test:prisma:seed" : " dotenv -e .env.test prisma db seed"
2524 },
2625 "prisma" : {
2726 "seed" : " tsx ./prisma/seed.ts"
5251 "react-router" : " ^7.5.1" ,
5352 "tailwind-merge" : " ^2.5.5" ,
5453 "tailwindcss-animate" : " ^1.0.7" ,
54+ "tsx" : " ^4.19.4" ,
5555 "zod" : " ^3.24.2"
5656 },
5757 "devDependencies" : {
8282 "prisma" : " ^6.10.1" ,
8383 "react-router-devtools" : " ^1.1.10" ,
8484 "tailwindcss" : " ^3.4.17" ,
85- "tsx" : " ^4.19.4" ,
8685 "typescript" : " ~5.6.2" ,
8786 "typescript-eslint" : " ^8.15.0" ,
8887 "vite" : " ^6.0.1" ,
Original file line number Diff line number Diff line change 11import { categories , products } from "./initial_data" ;
2-
3- import { PrismaClient } from "@/../generated/prisma/client" ;
2+ import { PrismaClient } from "../generated/prisma/client" ;
43
54const prisma = new PrismaClient ( ) ;
65
You can’t perform that action at this time.
0 commit comments