forked from Krishnamurtyp/mean-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdockerfile
33 lines (22 loc) · 752 Bytes
/
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
### STAGE 1: Build ###
# We label our stage as ‘builder’
FROM node:16-alpine as builder
COPY frontend/package.json frontend/package-lock.json ./
## Storing node modules on a separate layer will prevent unnecessary npm installs at each build
RUN npm ci && mkdir /app && mv ./node_modules ./app
WORKDIR /app
COPY /frontend .
## Build the angular app in production mode and store the artifacts in dist folder
RUN npm run build:prod
### STAGE 2: Setup ###
FROM node:16-alpine
## channge directory
WORKDIR /app
#COPY api code to app folder
COPY /api/ /app/
RUN npm ci
## From ‘builder’ copy published angular bundles in app/public
COPY --from=builder /app/dist /app/public
## expose port for express
EXPOSE 3000
CMD ["node", "server.js"]