-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.Dockerfile
More file actions
46 lines (28 loc) · 897 Bytes
/
server.Dockerfile
File metadata and controls
46 lines (28 loc) · 897 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# ===== Builder Stage ===== (For generating Prisma client)
FROM node:18.17.0-alpine AS builder
WORKDIR /slightly_techie
COPY package*.json ./
COPY prisma ./prisma/
RUN npm install
RUN npx prisma generate
# ===== Development Stage ===== (With hot-reload)
FROM node:18.17.0-alpine AS dev
WORKDIR /slightly_techie
# Copy from builder (node_modules + generated Prisma client)
COPY --from=builder /slightly_techie/node_modules ./node_modules
COPY --from=builder /slightly_techie/prisma ./prisma
# Install nodemon globally for hot-reload
RUN npm install -g nodemon
COPY . .
EXPOSE 5000
CMD ["nodemon", "--exec", "npm", "start"] # Hot-reload on file changes
# ===== Production Stage =====
FROM node:18.17.0-alpine AS prod
WORKDIR /slightly_techie
COPY package*.json ./
COPY prisma ./prisma/
RUN npm install --omit=dev
RUN npx prisma generate
COPY . .
EXPOSE 5000
CMD [ "npm", "start"]