-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
64 lines (48 loc) · 1.39 KB
/
Dockerfile
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
####################################
# Base image
####################################
FROM node:14.15.5-alpine AS base
WORKDIR /base
COPY package*.json ./
COPY .npmrc ./
COPY nodemon.json ./
COPY tsconfig.json ./
COPY .prettierrc.js ./
COPY .prettierignore ./
COPY .eslintrc.js ./
COPY .eslintignore ./
COPY src ./src
COPY prisma ./prisma
RUN npm install [email protected]
RUN npm ci --production
####################################
# Build process
####################################
FROM base AS build
ENV NODE_ENV=production
WORKDIR /build
COPY --from=base /base ./
RUN npm run build
####################################
# Production image
####################################
FROM node:14.15.5-alpine AS production
ENV NODE_ENV=production
WORKDIR /app
COPY --from=build /build/package*.json ./
COPY --from=build /build/.npmrc ./
COPY --from=build /build/prisma ./
COPY --from=build /build/nodemon.json ./
COPY --from=build /build/tsconfig.json ./
COPY --from=build /build/.prettierrc.js ./
COPY --from=build /build/.prettierignore ./
COPY --from=build /build/.eslintrc.js ./
COPY --from=build /build/.eslintignore ./
COPY --from=build /build/dist ./dist
COPY --from=build /build/prisma ./prisma
COPY --from=build /build/node_modules ./node_modules
# Expose port
EXPOSE $PORT
# Run command
CMD npm run migrate && \
node ./dist/src/index.js