-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile_alpine3.16_bak
76 lines (57 loc) · 2.86 KB
/
Dockerfile_alpine3.16_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
#FROM registry.cn-hangzhou.aliyuncs.com/zhangbo007/node:16.16.0-alpine-alpine
FROM node:16.16.0-alpine3.16
#FROM alpine
# 设置镜像作者
# We don't need the standalone Chromium
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
# 设置国内阿里云镜像站、安装chromium 81、文泉驿免费中文字体等依赖库
RUN echo "https://mirrors.aliyun.com/alpine/v3.16/main/" > /etc/apk/repositories \
&& echo "https://mirrors.aliyun.com/alpine/v3.16/community/" >> /etc/apk/repositories \
&& echo "https://mirrors.aliyun.com/alpine/edge/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 \
zlib-dev \
wqy-zenhei@edge \
bash \
bash-doc \
bash-completion \
font-adobe-100dpi \
ttf-dejavu \
fontconfig
#FROM alpine
# 设置镜像作者
LABEL MAINTAINER="zhangbo"
# 设置工作目录
WORKDIR /app
# 清除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" ]
#curl -d '{"url": "http://127.0.0.1:7001/public/index.html"}' -H 'Content-Type: application/json' http://127.0.0.1:7001/pdf/create
#curl -d '{"url": "https://www.baidu.com/"}' -H 'Content-Type: application/json' http://127.0.0.1:7001/pdf/create
#
#
#{"code":1,"data":{"name":"eval_pdf_daily/zhangbotest.pdf","url":"http://spf-material-input.oss-cn-shanghai.aliyuncs.com/eval_pdf_daily/zhangbotest.pdf","res":{"status":200,"statusCode":200,"statusMessage":"OK","headers":{"server":"AliyunOSS","date":"Wed, 10 Aug 2022 04:39:59 GMT","content-length":"0","connection":"keep-alive","x-oss-request-id":"62F3369FB9FD8B39319AFA17","etag":"\"D55BCF9F7102257D008A5A022AE55AF3\"","x-oss-hash-crc64ecma":"16662105587250485876","content-md5":"1VvPn3ECJX0AiloCKuVa8w==","x-oss-version-id":"CAEQJhiBgID23ZqYlBgiIDRmMWMwNzE1YTUzZDQzNjc4Y2ZiMmEyNmJkMWEzMGJk","x-oss-server-time":"91"},"size":0,"aborted":false,"rt":104,"keepAliveSocket":false,"data":{"type":"Buffer","data":[]},"requestUrls":["http://spf-material-input.oss-cn-shanghai.aliyuncs.com/eval_pdf_daily/zhangbotest.pdf"],"timing":null,"remoteAddress":"106.14.229.14","remotePort":80,"socketHandledRequests":1,"socketHandledResponses":1}},"msg":"创建成功"}