|
@@ -3,57 +3,59 @@ FROM centos:centos7.9.2009
|
|
|
|
|
|
# 配置容器时间
|
|
|
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
|
|
|
-
|
|
|
# 添加快捷命令
|
|
|
RUN echo "alias ll='ls -hall'" >> ~/.bashrc && source ~/.bashrc
|
|
|
|
|
|
# 更新yum源, 并生成缓存
|
|
|
RUN curl -o /etc/yum.repos.d/CentOS7-Aliyun.repo http://mirrors.aliyun.com/repo/Centos-7.repo && curl -o /etc/yum.repos.d/epel-7-Aliyun.repo http://mirrors.aliyun.com/repo/epel-7.repo
|
|
|
RUN yum clean all && yum makecache && yum -y update
|
|
|
+RUN yum install -y wget unzip dbus-x11
|
|
|
|
|
|
-
|
|
|
-# crontab服务安装和启动
|
|
|
-RUN yum -y install vixie-cron crontabs && systemctl start crond.service && systemctl enable crond.service
|
|
|
-
|
|
|
+# Allow container to access D-Bus
|
|
|
+ENV DBUS_SESSION_BUS_ADDRESS=/dev/null
|
|
|
|
|
|
WORKDIR /opt
|
|
|
-# 安装node
|
|
|
# 安装node, 更换npm源
|
|
|
RUN curl -fsSL https://rpm.nodesource.com/setup_14.x | bash && yum -y install nodejs && npm config set registry https://registry.npm.taobao.org
|
|
|
+# 设置全局NODE_PATH
|
|
|
+ENV NODE_PATH="/usr/lib/node_modules"
|
|
|
|
|
|
# 安装 python3.8.10 gcc相关配置
|
|
|
-RUN yum --exclude=kernel* update -y && yum groupinstall -y 'Development Tools' && yum install -y gcc openssl-devel bzip2-devel libffi-devel wget gtk3 libXt kde-l10n-Chinese glibc-common unzip
|
|
|
-
|
|
|
+RUN yum --exclude=kernel* update -y && yum groupinstall -y 'Development Tools' && yum install -y gcc openssl-devel bzip2-devel libffi-devel gtk3 libXt kde-l10n-Chinese glibc-common sqlite-devel
|
|
|
# python3.8.10下载与解压缩
|
|
|
RUN curl -o python3.8.10.tgz https://mirrors.huaweicloud.com/python/3.8.10/Python-3.8.10.tgz && tar -zxvf python3.8.10.tgz
|
|
|
-
|
|
|
-# 创建编译安装目录, 配置安装位置
|
|
|
-RUN mkdir /usr/local/python38
|
|
|
+# 切换目录
|
|
|
WORKDIR /opt/Python-3.8.10
|
|
|
-RUN ./configure --prefix=/usr/local/python38 && make && make install
|
|
|
-
|
|
|
+# 创建编译安装目录, 配置安装位置
|
|
|
+RUN mkdir /usr/local/python38 && ./configure --prefix=/usr/local/python38
|
|
|
+# 编译和安装
|
|
|
+RUN make -j 8 && make altinstall
|
|
|
# 添加python3的软连接
|
|
|
-RUN rm -rf /usr/bin/python3 /usr/bin/pip3 && ln -s /usr/local/python38/bin/python3 /usr/bin/python3 && ln -s /usr/local/python38/bin/pip3.8 /usr/bin/pip3
|
|
|
+RUN rm -rf /usr/bin/python3 /usr/bin/pip3 && ln -s /usr/local/python38/bin/python3.8 /usr/bin/python3 && ln -s /usr/local/python38/bin/pip3.8 /usr/bin/pip3
|
|
|
# 更换pip源&更新pip
|
|
|
-RUN pip3 config set global.index-url https://mirrors.bfsu.edu.cn/pypi/web/simple && pip3 install --upgrade pip
|
|
|
-
|
|
|
-# node 项目依赖
|
|
|
-WORKDIR /usr/lib/node_modules/npm
|
|
|
-RUN npm i crypto@1.0.1 crypto-js@4.1.1 js-md5@0.7.3 jsdom@19.0.0 jsdom@19.0.0 jsencrypt@3.2.1 node-bignumber@1.2.2 xhr2@0.2.1 -g
|
|
|
-RUN echo 'export NODE_PATH="/usr/lib/node_modules' >> /etc/profile
|
|
|
+RUN pip3 config set global.index-url https://mirrors.aliyun.com/pypi/simple && pip3 install --upgrade pip
|
|
|
+# 虚拟环境加入系统环境变量
|
|
|
+ENV PATH="/usr/local/python38/bin:$PATH"
|
|
|
|
|
|
# selenium filefox环境安装
|
|
|
-# 下载火狐浏览器
|
|
|
+# 下载和安装火狐浏览器
|
|
|
RUN wget https://download-installer.cdn.mozilla.net/pub/firefox/releases/78.0/linux-x86_64/zh-CN/firefox-78.0.tar.bz2 && tar -jxvf firefox-78.0.tar.bz2 && ln -s /opt/firefox/firefox /usr/bin/firefox
|
|
|
-# 下载驱动
|
|
|
+# 下载和安装驱动
|
|
|
RUN wget https://baibai.ink:88/selenium/firefox/geckodriver/0.31.0/geckodriver && chmod +x geckodriver && ln -s /opt/geckodriver /usr/bin/geckodriver
|
|
|
|
|
|
-# 指定工作目录
|
|
|
-WORKDIR /mnt
|
|
|
+# 设置编码
|
|
|
+RUN localedef -c -f UTF-8 -i zh_CN zh_CN.utf8
|
|
|
+RUN export LANG=zh_CN.UTF-8
|
|
|
|
|
|
-# 当前目录下 源文件 复制到 工作目录 下
|
|
|
-COPY . .
|
|
|
+# 安装 node 项目依赖
|
|
|
+RUN npm i -g crypto-js@4.1.1 js-md5@0.7.3 jsdom@19.0.0 jsencrypt@3.2.1 node-bignumber@1.2.2 xhr2@0.2.1
|
|
|
|
|
|
-# 安装 python 项目依赖和 node 项目依赖
|
|
|
+# 指定框架安装路径
|
|
|
+WORKDIR /app
|
|
|
+COPY . .
|
|
|
+# 安装 python 项目依赖
|
|
|
+RUN python3 setup.py install
|
|
|
RUN pip3 install -r requirements.txt
|
|
|
-RUN npm install
|
|
|
+
|
|
|
+# 指定工作目录
|
|
|
+WORKDIR /mnt
|