-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile_bak
119 lines (86 loc) · 3.15 KB
/
Dockerfile_bak
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
FROM registry.cn-hangzhou.aliyuncs.com/zhangbo007/node:14.18.0-alpine
#FROM alpine
# 设置镜像作者
LABEL MAINTAINER="zhangbo"
# 设置工作目录
WORKDIR /app
# We don't need the standalone Chromium
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
# 设置国内阿里云镜像站、安装chromium 102、文泉驿免费中文字体等依赖库
#RUN echo "https://mirrors.aliyun.com/alpine/v3.11/main/" > /etc/apk/repositories \
# && echo "https://mirrors.aliyun.com/alpine/v3.11/community/" >> /etc/apk/repositories \
# && echo "https://mirrors.aliyun.com/alpine/edge/testing/" >> /etc/apk/repositories \
# && apk -U --no-cache update && apk -U --no-cache --allow-untrusted add \
# zlib-dev \
# xorg-server \
# dbus \
# ttf-freefont \
# nss \
# freetype \
# freetype-dev \
# harfbuzz \
# ca-certificates \
# chromium \
# wqy-zenhei@edge \
# bash \
# bash-doc \
# bash-completion -f
#RUN echo @edge http://nl.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories && apk add
# Installs latest Chromium (100) package.
#RUN set -eux && sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
RUN echo "https://mirrors.aliyun.com/alpine/v3.11/main/" > /etc/apk/repositories \
&& echo "https://mirrors.aliyun.com/alpine/v3.11/community/" >> /etc/apk/repositories \
&& echo "https://mirrors.aliyun.com/alpine/latest-stable/testing" >> /etc/apk/repositories \
&& apk --no-cache update && apk add --no-cache --force-broken-world --allow-untrusted add \
chromium \
nss \
freetype \
harfbuzz \
ca-certificates \
ttf-freefont \
nodejs \
yarn \
zlib-dev \
wqy-zenhei@edge \
bash \
bash-doc \
bash-completion \
font-adobe-100dpi \
ttf-dejavu \
fontconfig
# && rm -rf /var/cache/*
#RUN apk add wqy-zenhei --update-cache --repository https://mirrors.aliyun.com/alpine/edge/testing --allow-untrusted
## Add user so we don't need --no-sandbox.
#RUN addgroup -S pptruser && adduser -S -G pptruser pptruser \
# && mkdir -p /home/pptruser/Downloads /app \
# && chown -R pptruser:pptruser /home/pptruser \
# && chown -R pptruser:pptruser /app/ \
# && chown -R pptruser:pptruser /usr
#
## Run everything after as non-privileged user.
#USER pptruser
# 设置时区
#RUN rm -rf /etc/localtime && ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
#RUN npm -v && npm config set registry="http://r.dtwave-inc.com"
# 清除npm缓存文件
RUN npm cache clean --force && npm cache verify
# 设置环境变量
ENV NODE_ENV prod
# 设置yuan
RUN npm config set registry https://registry.npm.taobao.org
# 复制文件
COPY . .
# 手动将字体复制到目录
RUN mkdir -p /usr/share/fonts/win
RUN cp /app/font/Microsoft-YaHei.ttf /usr/share/fonts/win/Microsoft-YaHei.ttf
RUN cp /app/font/Arial.ttf /usr/share/fonts/win/Arial.ttf
RUN chmod 777 /usr/share/fonts/win/* \
&& fc-cache -fv && fc-list
RUN npm install cnpm -g
# 安装依赖
RUN cnpm install
RUN npm run tsc
# 暴露端口
EXPOSE 8001
CMD [ "npm", "run", "prod" ]