-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Dockerfile
124 lines (124 loc) · 3.74 KB
/
Dockerfile
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
120
121
122
123
124
FROM ubuntu:latest
ARG S6_VERSION=v2.2.0.3
ARG S6_ARCH=amd64
ARG DEBIAN_FRONTEND=noninteractive
ARG USER_NAME=pagermaid
ARG WORK_DIR=/pagermaid/workdir
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
SHELL=/bin/bash \
LANG=zh_CN.UTF-8 \
PS1="\u@\h:\w \$ " \
RUN_AS_ROOT=true
SHELL ["/bin/bash", "-c"]
WORKDIR $WORK_DIR
RUN source ~/.bashrc \
## 安装运行环境依赖,自编译建议修改为国内镜像源
# && sed -i 's/archive.ubuntu.com/mirrors.bfsu.edu.cn/g' /etc/apt/sources.list \
# && sed -i 's/security.ubuntu.com/mirrors.bfsu.edu.cn/g' /etc/apt/sources.list \
# && sed -i 's/ports.ubuntu.com/mirrors.bfsu.edu.cn/g' /etc/apt/sources.list \
&& apt-get update \
&& apt-get upgrade -y \
&& apt-get install --no-install-recommends -y \
python3 \
python3-pip \
tesseract-ocr \
tesseract-ocr-eng \
tesseract-ocr-chi-sim \
language-pack-zh-hans \
sudo \
git \
openssl \
redis-server \
curl \
wget \
neofetch \
imagemagick \
ffmpeg \
fortune-mod \
figlet \
libmagic1 \
libzbar0 \
iputils-ping \
## 安装s6
&& curl -L -o /tmp/s6-overlay-installer https://github.com/just-containers/s6-overlay/releases/download/${S6_VERSION}/s6-overlay-${S6_ARCH}-installer \
&& chmod +x /tmp/s6-overlay-installer \
&& /tmp/s6-overlay-installer / \
## 安装编译依赖
&& apt-get update \
&& apt-get install --no-install-recommends -y \
## 这是跨平台交叉编译要用到的包,如果自行构建,有可能不需要
build-essential \
apt-utils \
python3-dev \
libxslt1-dev \
libxml2-dev \
libssl-dev \
libffi-dev \
zlib1g-dev \
tcl8.6-dev \
tk8.6-dev \
libimagequant-dev \
libraqm-dev \
libjpeg-dev \
libtiff5-dev \
libopenjp2-7-dev \
libfreetype6-dev \
liblcms2-dev \
libwebp-dev \
python3-tk \
libharfbuzz-dev \
libfribidi-dev \
libxcb1-dev \
pkg-config \
## 设置时区
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone \
## python软链接
&& ln -sf /usr/bin/python3 /usr/bin/python \
## 升级pip
# && pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple \
&& python -m pip install --upgrade pip \
## 添加用户
&& useradd $USER_NAME -u 917 -U -r -m -d /$USER_NAME -s /bin/bash \
&& usermod -aG sudo,users $USER_NAME \
&& echo "$USER_NAME ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/$USER_NAME \
## 克隆仓库
&& git clone -b master https://gitlab.com/Xtao-Labs/pagermaid-modify.git $WORK_DIR \
&& git config --global pull.ff only \
## 复制s6启动脚本
&& cp -r s6/* / \
## pip install
&& pip install -r requirements.txt \
## 卸载编译依赖,清理安装缓存
&& sudo apt-get purge --auto-remove -y \
build-essential \
apt-utils \
python3-dev \
libxslt1-dev \
libxml2-dev \
libssl-dev \
libffi-dev \
zlib1g-dev \
tcl8.6-dev \
tk8.6-dev \
libimagequant-dev \
libraqm-dev \
libjpeg-dev \
libtiff5-dev \
libopenjp2-7-dev \
libfreetype6-dev \
liblcms2-dev \
libwebp-dev \
python3-tk \
libharfbuzz-dev \
libfribidi-dev \
libxcb1-dev \
pkg-config \
&& apt-get clean -y \
&& rm -rf \
## 删除apt和pip的安装缓存
/tmp/* \
/var/lib/apt/lists/* \
/var/tmp/* \
~/.cache
ENTRYPOINT ["/init"]