reposync/Dockerfile

45 lines
1.3 KiB
Docker
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

FROM quay.io/centos/centos:7
RUN curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo && \
yum makecache && \
yum update -y && \
yum install -y wget gcc make openssl-devel bzip2-devel libffi-devel zlib-devel
# 下载并安装Python 3.9.6
RUN wget -P /data/ob-tool https://mirrors.huaweicloud.com/python/3.9.6/Python-3.9.6.tgz && \
cd /data/ob-tool && \
tar xzf Python-3.9.6.tgz && \
cd Python-3.9.6 && \
./configure --enable-optimizations && \
make altinstall
# 将项目文件复制到容器中
ADD ./ /data/ob-robot/
RUN pip3.9 install -r /data/ob-robot/requirement.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/
# 安装Git和OpenSSH服务器
RUN yum install -y git openssh-server
# 设置Git SSH连接配置
ENV GIT_SSH_COMMAND='ssh -o StrictHostKeyChecking=no -i /root/.ssh/id_rsa'
# 安装autoconf和gettext并编译安装Git 2.32.0
RUN yum install -y autoconf gettext && \
wget http://github.com/git/git/archive/v2.32.0.tar.gz && \
tar -xvf v2.32.0.tar.gz && \
rm -f v2.32.0.tar.gz && \
cd git-* && \
make configure && \
./configure --prefix=/usr && \
make -j16 && \
make install
# 设置工作目录
WORKDIR /data/ob-robot
# 定义启动命令
CMD if [ "$BOOT_MODE" = "app" ]; then python3.9 main.py; fi