|
@@ -0,0 +1,49 @@
|
|
|
|
+# 拉取镜像
|
|
|
|
+FROM centos:centos7.9.2009
|
|
|
|
+
|
|
|
|
+# 添加快捷命令
|
|
|
|
+RUN echo "alias ll='ls -hall'" >> ~/.bashrc && source ~/.bashrc
|
|
|
|
+
|
|
|
|
+# 配置容器时间
|
|
|
|
+RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
|
|
|
|
+
|
|
|
|
+# 更新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 kde-l10n-Chinese
|
|
|
|
+
|
|
|
|
+# 设置编码
|
|
|
|
+RUN export LANG=zh_CN.UTF-8
|
|
|
|
+# 设置系统语言
|
|
|
|
+RUN localedef -c -f UTF-8 -i zh_CN zh_CN.utf8
|
|
|
|
+# 设置vi编码(防止中文乱码)
|
|
|
|
+RUN grep -qxF 'set encoding=utf8' /etc/virc || echo 'set encoding=utf8' >> /etc/virc
|
|
|
|
+
|
|
|
|
+WORKDIR /opt
|
|
|
|
+# 安装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
|
|
|
|
+
|
|
|
|
+# 安装 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 gtk3 libXt glibc-common
|
|
|
|
+# 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
|
|
|
|
+# 切换工作目录
|
|
|
|
+WORKDIR /opt/Python-3.8.10
|
|
|
|
+# 创建编译安装目录, 配置安装位置
|
|
|
|
+RUN mkdir /usr/local/python38
|
|
|
|
+RUN ./configure --prefix=/usr/local/python38 && make -j 8 && make altinstall
|
|
|
|
+# 添加python3的软连接
|
|
|
|
+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.aliyun.com/pypi/simple && pip3 install --upgrade pip
|
|
|
|
+# 虚拟环境加入系统环境变量
|
|
|
|
+ENV PATH="/usr/local/python38/bin:$PATH"
|
|
|
|
+
|
|
|
|
+# 设置工作目录
|
|
|
|
+WORKDIR /mnt
|
|
|
|
+COPY . .
|
|
|
|
+
|
|
|
|
+# 安装node项目依赖
|
|
|
|
+RUN npm install
|
|
|
|
+# 安装python项目依赖
|
|
|
|
+RUN pip3 install -r requirements.txt
|