-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
56 lines (34 loc) · 960 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
###################
# BUILD FOR LOCAL DEVELOPMENT
###################
FROM node:18-alpine As development
COPY --chown=node:node package*.json ./
COPY --chown=node:node yarn.lock ./
RUN yarn
COPY --chown=node:node . .
USER node
###################
# BUILD FOR PRODUCTION
###################
FROM node:18-alpine As build
ARG TOKEN
ARG CLIENT_ID
WORKDIR /app
COPY --chown=node:node package*.json ./
COPY --chown=node:node . .
RUN yarn
RUN yarn build
ENV NODE_ENV production
RUN yarn --production && yarn cache clean
USER node
###################
# PRODUCTION
###################
FROM node:18-alpine As production
# Copy the bundled code from the build stage to the production image
COPY --chown=node:node --from=build /app/package*.json ./
COPY --chown=node:node --from=build /app/node_modules ./node_modules
COPY --chown=node:node --from=build /app/dist ./dist
EXPOSE 80
# Start the server using the production build
CMD [ "yarn", "start" ]