-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
39 lines (27 loc) · 917 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
FROM node:20.13.1-alpine3.18 as builder
ENV HOME=/home/app
ENV APP_PATH=$HOME/listing-frontend
# Copy necessary files for installing dependencies
COPY yarn.lock package.json .yarnrc.yml $APP_PATH/
# Enable yarn
RUN corepack enable
# Run yarn before src copy to enable better layer caching
WORKDIR $APP_PATH
RUN mkdir -p $APP_PATH/build && yarn install --immutable
# Copy necessary source files for server and client build
COPY .babelrc postcss.config.js tsconfig.json $APP_PATH/
COPY webpack $APP_PATH/webpack
COPY scripts $APP_PATH/scripts
COPY src $APP_PATH/src
COPY public $APP_PATH/public
# Build client code
RUN yarn run build
# Run stage
FROM node:20.13.1-alpine3.18
ENV HOME=/home/app
ENV APP_PATH=$HOME/listing-frontend
WORKDIR $APP_PATH
RUN npm install -g cross-env bunyan
COPY --from=builder $APP_PATH/build build
COPY --from=builder $APP_PATH/package.json $APP_PATH/
CMD ["yarn", "start-prod"]