File tree Expand file tree Collapse file tree 6 files changed +565
-14
lines changed
Expand file tree Collapse file tree 6 files changed +565
-14
lines changed Original file line number Diff line number Diff line change 11
22services :
33 postgres :
4- image : postgres:15 -alpine
4+ image : postgres:17 -alpine
55 container_name : postgres
66 restart : always
77 env_file :
88 - .env
9+ healthcheck :
10+ test : [ "CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB" ]
11+ interval : 5s
12+ timeout : 5s
13+ retries : 5
914 volumes :
1015 - postgres:/var/lib/postgresql/data
1116 networks :
@@ -21,7 +26,8 @@ services:
2126 ports :
2227 - " 3001:3000"
2328 depends_on :
24- - postgres
29+ postgres :
30+ condition : service_healthy
2531 networks :
2632 - app-network
2733
Original file line number Diff line number Diff line change 11
2- FROM node:20 -alpine as builder
2+ FROM node:22 -alpine as builder
33
44WORKDIR /app
55
66COPY package*.json ./
7- COPY prisma ./prisma/
8-
9-
10- RUN npm ci && npx prisma generate
7+ RUN npm ci
118
129COPY . .
1310
11+ RUN npx prisma generate
12+
1413
1514RUN npm run build && npm cache clean --force
1615
17- FROM node:20 -alpine
16+ FROM node:22 -alpine
1817
1918WORKDIR /app
2019
20+ COPY --chown=node:node docker/entrypoint.sh ./entrypoint.sh
21+ RUN chmod +x ./entrypoint.sh
22+
2123COPY --from=builder --chown=node:node /app/node_modules ./node_modules
2224COPY --from=builder --chown=node:node /app/package*.json ./
2325COPY --from=builder --chown=node:node /app/dist ./dist
2426COPY --from=builder --chown=node:node /app/prisma ./prisma
2527
28+
29+ COPY --from=builder --chown=node:node /app/prisma.config.ts ./
30+
2631USER node
2732
2833EXPOSE 3000
2934
30- CMD ["node" , "dist/src/main " ]
35+ ENTRYPOINT ["./entrypoint.sh " ]
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ set -e
3+
4+ echo " [DEBUG] Waiting for postgres (sleeping 5s)..."
5+ sleep 5
6+
7+ echo " [DEBUG] Start prisma migration"
8+ npx prisma migrate deploy
9+
10+ echo " [DEBUG] Starting application..."
11+ exec node dist/src/main.js
You can’t perform that action at this time.
0 commit comments