2023-02-16 07:25:29 -05:00
|
|
|
# build front-end
|
2023-03-12 21:03:17 -04:00
|
|
|
FROM node:lts-alpine AS frontend
|
|
|
|
|
|
|
|
RUN npm install pnpm -g
|
2023-02-16 00:39:07 -05:00
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
2023-03-12 21:03:17 -04:00
|
|
|
COPY ./package.json /app
|
|
|
|
|
|
|
|
COPY ./pnpm-lock.yaml /app
|
|
|
|
|
|
|
|
RUN pnpm install
|
|
|
|
|
|
|
|
COPY . /app
|
|
|
|
|
|
|
|
RUN pnpm run build
|
|
|
|
|
|
|
|
# build backend
|
|
|
|
FROM node:lts-alpine as backend
|
|
|
|
|
|
|
|
RUN npm install pnpm -g
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
COPY /service/package.json /app
|
|
|
|
|
|
|
|
COPY /service/pnpm-lock.yaml /app
|
|
|
|
|
|
|
|
RUN pnpm install
|
|
|
|
|
|
|
|
COPY /service /app
|
|
|
|
|
|
|
|
RUN pnpm build
|
2023-02-16 07:25:29 -05:00
|
|
|
|
|
|
|
# service
|
|
|
|
FROM node:lts-alpine
|
|
|
|
|
2023-03-12 21:03:17 -04:00
|
|
|
RUN npm install pnpm -g
|
2023-02-16 07:25:29 -05:00
|
|
|
|
2023-02-16 00:39:07 -05:00
|
|
|
WORKDIR /app
|
2023-03-09 04:52:39 -05:00
|
|
|
|
2023-03-12 21:03:17 -04:00
|
|
|
COPY /service/package.json /app
|
|
|
|
|
|
|
|
COPY /service/pnpm-lock.yaml /app
|
|
|
|
|
|
|
|
RUN pnpm install --production && rm -rf /root/.npm /root/.pnpm-store /usr/local/share/.cache /tmp/*
|
|
|
|
|
|
|
|
COPY /service /app
|
|
|
|
|
|
|
|
COPY --from=frontend /app/dist /app/public
|
|
|
|
|
|
|
|
COPY --from=backend /app/build /app/build
|
2023-02-16 00:39:07 -05:00
|
|
|
|
|
|
|
EXPOSE 3002
|
|
|
|
|
2023-03-12 21:03:17 -04:00
|
|
|
CMD ["pnpm", "run", "prod"]
|