22
schangxiang@126.com
2024-06-12 27db09a32a2ae716abb2bc4eb1902d3e3851412b
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
# build
FROM node:latest AS builder
 
# 切换编译目录
WORKDIR /build
COPY ./ ./
# 编译项目 测试
RUN yarn config set registry https://registry.npm.taobao.org/ \
  && yarn install \
  && yarn run build:development
 
# 编译项目 正式
#RUN yarn config set registry https://registry.npm.taobao.org/ \
#  && yarn install \
#  && yarn run build
 
# web
FROM nginx:alpine
 
# 时区
ENV TZ=Asia/Shanghai
RUN echo "http://mirrors.aliyun.com/alpine/v3.4/main/" > /etc/apk/repositories \
  && apk --no-cache add tzdata zeromq \
  && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \
  && echo '$TZ' > /etc/timezone
 
COPY ./docker/nginx/logs /var/log/nginx
COPY ./docker/nginx/vhost /etc/nginx/conf.d/
COPY ./docker/nginx/nginx.conf /etc/nginx/nginx.conf
 
# 拷贝项目
COPY --from=builder /build/dist/ /var/www/html