代码拉取完成,页面将自动刷新
同步操作将从 MuZi/kingbase8-image 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
# 基础镜像,amazoncorretto使用8版本
FROM centos:8
# 作者
LABEL author="TuShiKJ"
# 系统编码
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
## 设置时区
ENV TZ=Asia/Shanghai
RUN ln -sf /usr/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
#拷贝安装包
RUN mkdir /install
ADD install/amazon-corretto-11.0.19.7.1-linux-x64.tar.gz /install
ADD install/nginx-1.24.0.tar.gz /install
ADD install/redis-6.2.12.tar.gz /install
ADD install/license.zip /install
ADD install/KingbaseES_V008R006C007B0024_Lin64_install.iso /install
#初始化安装环境
RUN echo 'init install env' && \
#解决centos8由于不维护导致不能安装依赖问题
cd /etc/yum.repos.d/ && \
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* && \
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* && \
yum update -y && \
#下载依赖
yum install -y gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel && \
#下载编译工具
yum install -y make && \
#下载请求工具
yum install -y wget && \
#安装7zip,解压Kingbase8的镜像文件,以及license
dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm && \
dnf -y install p7zip p7zip-plugins && \
echo 'init install env success' && \
#安装jdk
echo 'Start install jdk' && \
mkdir /usr/local/java && \
cd /install && \
# wget https://corretto.aws/downloads/latest/amazon-corretto-11-x64-linux-jdk.tar.gz && \
# tar -xvf amazon-corretto-11-x64-linux-jdk.tar.gz && \
cp -rf /install/amazon-corretto-11.0.19.7.1-linux-x64/* /usr/local/java/ && \
#rm -rf amazon-corretto-11-x64-linux-jdk.tar.gz && \
rm -rf /install/amazon-corretto-11.0.19.7.1-linux-x64 && echo 'install jdk success' && \
#安装nginx
echo 'Start install nginx' && \
mkdir /usr/local/nginx && \
# wget https://nginx.org/download/nginx-1.24.0.tar.gz && \
# tar -xvf nginx-1.24.0.tar.gz && \
cd /install/nginx-1.24.0 && \
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module && \
make install && \
rm -rf /install/nginx-1.24.0 && \
#rm -rf /install/nginx-1.24.0.tar.gz && \
echo 'install nginx success' && \
#安装redis
echo 'Start install redis' && \
mkdir /usr/local/redis && \
mkdir /usr/local/redis/conf && \
cd /install && \
# wget https://download.redis.io/releases/redis-6.2.12.tar.gz && \
# tar -xvf redis-6.2.12.tar.gz && \
cd /install/redis-6.2.12 && \
make && \
make install PREFIX=/usr/local/redis && \
cp -rf /install/redis-6.2.12/redis.conf /usr/local/redis/conf && \
rm -rf /install/redis-6.2.12 && \
#rm -rf /install/redis-6.2.12.tar.gz && \
echo 'install redis success' && \
#安装人大金仓
echo 'Start install KingbaseES' && \
cd /install && \
mkdir kingbase && \
mkdir /usr/local/kingbase && \
#mkdir /usr/local/kingbase/license && \
mkdir /usr/local/kingbase8 && \
mkdir /usr/local/kingbase8/license && \
#wget https://kingbase.oss-cn-beijing.aliyuncs.com/KESV8R3/license_%E4%BC%81%E4%B8%9A%E7%89%88.zip && \
7z x license.zip -r -olicense && \
rm -rf license.zip && \
cp -rf /install/license/license_29296/license_29296_0.dat /usr/local/kingbase8/license/license.dat && \
#wget https://kingbase.oss-cn-beijing.aliyuncs.com/KESV8R3/V008R006C007B0024/KingbaseES_V008R006C007B0024_Lin64_install.iso && \
7z x KingbaseES_V008R006C007B0024_Lin64_install.iso -r -okingbase && \
rm -rf KingbaseES_V008R006C007B0024_Lin64_install.iso && \
#修改Kingbase8静默安装的配置,密码配置不上
sed -i 's|KB_LICENSE_PATH=|KB_LICENSE_PATH=/usr/local/kingbase8/license/license.dat|g' kingbase/setup/silent.cfg && \
sed -i 's|USER_INSTALL_DIR=/opt/Kingbase/ES/V8|USER_INSTALL_DIR=/usr/local/kingbase|g' kingbase/setup/silent.cfg && \
sed -i 's|USER_SELECTED_DATA_FOLDER=|USER_SELECTED_DATA_FOLDER=/usr/local/kingbase/data|g' kingbase/setup/silent.cfg && \
sed -i 's|DB_PASS=|DB_PASS=root|g' kingbase/setup/silent.cfg && \
sed -i 's|DB_PASS2=|DB_PASS2=root|g' kingbase/setup/silent.cfg && \
sed -i 's|DATABASE_MODE_PARAM=ORACLE|DATABASE_MODE_PARAM=PG|g' kingbase/setup/silent.cfg && \
#添加Kingbase的安装用户
useradd -ms /bin/bash kingbase && \
chown -R kingbase:kingbase /usr/local/kingbase && \
chown -R kingbase:kingbase /install/kingbase
USER kingbase
RUN cd /install/kingbase && \
chmod -R a+rwx setup.sh && \
./setup.sh -i silent -f ./silent.cfg && \
#初始化Kingbase数据库
/usr/local/kingbase/Server/bin/initdb -Usystem -D /usr/local/kingbase/data
USER root
RUN cd / && \
rm -rf /install/kingbase && \
rm -rf /usr/local/kingbase8 && \
mkdir /usr/local/kingbase/license && \
cp -rf /install/license/license_29296/license_29296_0.dat /usr/local/kingbase/license/license.dat && \
#创建日志文件存放位置
mkdir /usr/local/kingbase/log && \
touch /usr/local/kingbase/log/logfile.log && \
chmod -R a+rw /usr/local/kingbase/log/logfile.log && \
rm -rf /install/license
USER kingbase
#设置数据库用户system的默认密码
RUN /usr/local/kingbase/Server/bin/sys_ctl -D /usr/local/kingbase/data -l /usr/local/kingbase/log/logfile.log start && \
/usr/local/kingbase/Server/bin/ksql -c "alter user system password 'root';" -Usystem -dtest && \
/usr/local/kingbase/Server/bin/sys_ctl -D /usr/local/kingbase/data -l /usr/local/kingbase/log/logfile stop
USER root
#关闭容器内部无需密码就能登录数据库的问题(不关也行)
RUN sed -i 's|local all all trust|local all all scram-sha-256|g' /usr/local/kingbase/data/sys_hba.conf && \
sed -i 's|local replication all trust|local replication all scram-sha-256|g' /usr/local/kingbase/data/sys_hba.conf && \
#创建软连接,方便license替换
rm -rf /usr/local/kingbase/KESRealPro/V008R006C007B0024/license.dat && \
ln -s /usr/local/kingbase/license/license.dat /usr/local/kingbase/KESRealPro/V008R006C007B0024/license.dat && \
echo 'install KingbaseES success'
#配置java环境
ENV JAVA_HOME=/usr/local/java
ENV CLASSPATH=$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
ENV PATH=$PATH:$JAVA_HOME/bin
#配置nginx环境
ENV NGINX_HOME=/usr/local/nginx
ENV PATH=$PATH:$NGINX_HOME/sbin
#配置redis环境
ENV REDIS_HOME=/usr/local/redis
ENV PATH=$PATH:$REDIS_HOME/bin
# 对外面挂载的路径
#nginx对外暴露的路径
VOLUME /usr/local/nginx/conf
VOLUME /usr/local/nginx/logs
VOLUME /usr/local/nginx/html
#redis对外暴露的路径
VOLUME /usr/local/redis/conf
#kingbase8对外暴露的路径
VOLUME /usr/local/kingbase/license
VOLUME /usr/local/kingbase/data
# 暴露端口
EXPOSE 80
EXPOSE 6379
EXPOSE 54321
EXPOSE 9060
#设置启动脚本
ADD start.sh /
RUN cd / && chmod u+rwx /start.sh
# 启动容器时的进程
CMD ["sh","/start.sh"]
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。