-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
52 lines (40 loc) · 1.3 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
# Builder stage, for building the source code only
ARG NODE_VERSION=18.0.0
ARG VARIANT=alpine3.15
FROM node:${NODE_VERSION}-${VARIANT} as builder
LABEL maintainer="Developer Advocate"
# Create app directory
WORKDIR /app
# Install app dependencies and build configurations
# A wildcard is used to ensure both package.json AND package-lock.json are copied
COPY package*.json .
COPY tsconfig.json .
# Copy source
COPY src ./src
#RUN npm install
RUN npm install -g [email protected] \
&& npm ci \
&& npm cache clean --force
# Build app
RUN npm run build-minify
## Second stage, for running the application in a final image.
FROM node:${NODE_VERSION}-${VARIANT}
# Create app directory
WORKDIR /app
# Set ENV Production
ENV NODE_ENV production
#COPY configuration files
COPY --from=builder /app/package*.json .
COPY --from=builder /app/tsconfig.json .
#RUN npm install with Production flag
RUN npm install -g [email protected] \
&& npm ci --production\
&& npm cache clean --force
# Copy the bundle file and run script
COPY --from=builder /app/dist ./dist
# Set Docker to run the application with compress mode
ENTRYPOINT [ "node", "./dist/rdp_nodefetch.min.js"]
# For un-compress code
#ENTRYPOINT [ "node", "./dist/rdp_nodefetch.js"]
#For Node 17.5.0
#ENTRYPOINT [ "node", "--experimental-fetch", "./dist/rdp_nodefetch.js"]