React Docker image push takes too long time. I need to reduce its time. I have put the docker code.

Occasional Visitor
FROM node:16.9.1-alpine as build

# Copy required files/folders to docker directory
COPY package.json /app
COPY package-lock.json /app
COPY lerna.json /app
COPY yarn.lock /app
COPY babel.config.js /app
COPY shared /app/shared
COPY projects/tt-core /app/projects/tt-core

# Installing yarn dependicies and biuld the tt-core project
RUN yarn install --frozen-lockfile --non-interactive --production=false --ignore-scripts
RUN yarn build:tt-core

# run reactjs with nginx in production
FROM nginx:stable-alpine
COPY --from=build /app/projects/tt-core/build /usr/share/nginx/html
RUN rm /etc/nginx/conf.d/default.conf
COPY nginx/nginx.conf /etc/nginx/conf.d
COPY ssl /etc/ssl/certs

CMD ["nginx", "-g", "daemon off;"]

# serve the react js in production
# FROM mhart/alpine-node
# RUN yarn global add serve
# WORKDIR /app
# COPY --from=builder /home/app/projects/tt-core/build .
# CMD ["serve", "-p", "80", "-s", "."]
0 Replies