-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Dockerfile
42 lines (30 loc) · 1.11 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
############################################################
# Build stage
############################################################
FROM node:20.17.0-alpine3.20 AS build
RUN apk --no-cache add git
WORKDIR /src
# Copy package.json first to benefit from layer caching
COPY package*.json ./
# Install without scripts otherwise webpack will fail
RUN npm ci --omit=dev --ignore-scripts
# Copy production node_modules aside for later
RUN cp -R node_modules prod_node_modules
# Copy src to have webpack config files ready for install
COPY . /src
# Install remaining dev dependencies
RUN npm ci
# Run all webpack build steps
RUN npm run prepare && npm run build
############################################################
# Release stage
############################################################
FROM node:20.17.0-alpine3.20 AS release
WORKDIR /src
# Copy production node_modules
COPY --from=build /src/prod_node_modules /src/node_modules
COPY --from=build /src/package*.json /src/
# Copy compiled src dirs
COPY --from=build /src/Parse-Dashboard/ /src/Parse-Dashboard/
USER node
ENTRYPOINT ["node", "Parse-Dashboard/index.js"]