-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpeer.Dockerfile
61 lines (40 loc) · 1.16 KB
/
peer.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
#Build frontend
FROM node:lts as build-frontend
ARG NODE_ENV=development
ENV NODE_ENV=${NODE_ENV}
WORKDIR /build
COPY frontend/package.json package-lock.json ./
RUN npm i --package-lock-only && npm ci && npm cache clean --force
COPY frontend ./
RUN npm run build
RUN npm prune --production
#Build backend
FROM node:lts as build-backend
ARG NODE_ENV=development
ENV NODE_ENV=${NODE_ENV}
WORKDIR /build
COPY backend-peer/package.json package-lock.json ./
RUN npm ci && npm cache clean --force
COPY backend-peer ./
RUN npm run build
RUN npm prune --production
# Production stage
FROM node:lts-slim as production
ARG NODE_ENV=production
ENV NODE_ENV=${NODE_ENV}
# Need curl for healthcheck
RUN apt-get update && \
apt-get install -y curl
WORKDIR /app
COPY --from=build-backend \
/build/package.json \
/build/package-lock.json \
/build/build \
./
COPY --from=build-backend /build/node_modules ./node_modules
COPY --from=build-backend /build/prisma ./prisma
COPY --from=build-frontend /build/build /www
EXPOSE 3000
HEALTHCHECK --interval=5s --timeout=5s --retries=20 \
CMD curl -f http://localhost:3000/api/health || exit 1
CMD ["npm", "start"]