2022-05-22 10:04:58 +00:00
|
|
|
FROM node:18-alpine as builder
|
2022-06-28 12:26:30 +00:00
|
|
|
COPY . /app/
|
2022-05-22 10:04:58 +00:00
|
|
|
WORKDIR /app
|
|
|
|
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
|
2022-06-22 03:31:04 +00:00
|
|
|
RUN npm config set registry https://registry.npmmirror.com
|
2022-05-22 10:04:58 +00:00
|
|
|
RUN npm i -g pm2 @nestjs/cli pnpm
|
2022-07-17 01:37:13 +00:00
|
|
|
RUN apk --no-cache add bash dos2unix \
|
|
|
|
&& find . -name "*.sh" -exec dos2unix {} \; \
|
|
|
|
&& apk del dos2unix
|
2022-05-22 10:04:58 +00:00
|
|
|
RUN bash build-output.sh
|
|
|
|
|
|
|
|
FROM node:18-alpine as prod
|
|
|
|
ENV TZ=Asia/Shanghai
|
|
|
|
COPY --from=builder /app/docker/* /app/docker/
|
|
|
|
COPY --from=builder /app/output/ /app/
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
|
2022-06-22 03:31:04 +00:00
|
|
|
RUN npm config set registry https://registry.npmmirror.com
|
2022-06-28 15:46:57 +00:00
|
|
|
RUN set -x \
|
2022-05-22 10:04:58 +00:00
|
|
|
&& apk update \
|
2022-06-28 12:26:30 +00:00
|
|
|
&& apk add --no-cache tzdata redis \
|
2022-05-22 10:04:58 +00:00
|
|
|
&& chmod +x /app/docker/start.sh \
|
|
|
|
&& npm i -g pm2 @nestjs/cli pnpm \
|
|
|
|
&& rm -rf /var/cache/apk/*
|
|
|
|
|
|
|
|
ENTRYPOINT sh /app/docker/start.sh
|