forked from nitin27may/mean-docker
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
30 lines (21 loc) · 796 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
# Create image based off of the official Node 10 image
FROM node:16-alpine as builder
# Copy dependency definitions
COPY package.json package-lock.json ./
# disabling ssl for npm for Dev or if you are behind proxy
RUN npm set strict-ssl false
## installing and Storing node modules on a separate layer will prevent unnecessary npm installs at each build
RUN npm ci && mkdir /app && mv ./node_modules ./app
# Change directory so that our commands run inside this new directory
WORKDIR /app
# Get all the code needed to run the app
COPY . /app/
# Build server side bundles
RUN npm run build:ssr
FROM node:16-alpine
## From 'builder' copy published folder
COPY --from=builder /app /app
WORKDIR /app
# Expose the port the app runs in
EXPOSE 4000
CMD ["node", "dist/frontend/server/main.js"]