2024-03-22 14:58:37 +08:00
|
|
|
# 配置参数(指定基础镜像版本)
|
|
|
|
ARG BASE_TAG=15.5
|
|
|
|
|
|
|
|
# 基于 openSUSE 构建
|
|
|
|
FROM opensuse/leap:$BASE_TAG
|
|
|
|
|
|
|
|
# 配置参数
|
|
|
|
ARG GROUP_ID=1024 \
|
|
|
|
GROUP_NAME=openssl \
|
|
|
|
USER_ID=1024 \
|
|
|
|
USER_NAME=openssl \
|
|
|
|
USER_HOME=/home/openssl \
|
2024-03-25 14:24:44 +08:00
|
|
|
USER_SHELL=/bin/bash \
|
|
|
|
INSTALL_PATH=/opt/openssl
|
2024-03-22 14:58:37 +08:00
|
|
|
|
|
|
|
# 更新应用并安装基础应用、清除 zypper 缓存
|
|
|
|
RUN set -ex && \
|
|
|
|
zypper refresh && \
|
|
|
|
zypper update -y && \
|
|
|
|
zypper clean
|
|
|
|
|
|
|
|
# 设置时区、新建用户组及用户、配置目录权限
|
|
|
|
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
|
|
|
|
groupadd $GROUP_NAME -g $GROUP_ID && \
|
|
|
|
useradd $USER_NAME -g $GROUP_ID -d $USER_HOME -s $USER_SHELL -u $USER_ID && \
|
2024-03-25 14:24:44 +08:00
|
|
|
mkdir -pv $USER_HOME $INSTALL_PATH && \
|
|
|
|
chown -R $GROUP_NAME.$USER_NAME $USER_HOME $INSTALL_PATH
|
2024-03-22 14:58:37 +08:00
|
|
|
|
|
|
|
# 安装 OpenSSL
|
2024-03-25 14:24:44 +08:00
|
|
|
ADD openssl-3.2.1.zip $INSTALL_PATH/openssl-3.2.1.zip
|
|
|
|
RUN zypper install -y unzip && \
|
|
|
|
cd $INSTALL_PATH && \
|
|
|
|
unzip openssl-3.2.1.zip && \
|
|
|
|
rm -rf openssl-3.2.1.zip && \
|
|
|
|
zypper remove -y unzip && \
|
|
|
|
chown -R $GROUP_NAME.$USER_NAME $INSTALL_PATH && \
|
|
|
|
ln -s $INSTALL_PATH/openssl-3.2.1/lib64/libssl.so.3 /usr/lib64/libssl.so.3 && \
|
|
|
|
ln -s $INSTALL_PATH/openssl-3.2.1/lib64/libcrypto.so.3 /usr/lib64/libcrypto.so.3 && \
|
|
|
|
mv /usr/bin/openssl /usr/bin/openssl.bak && \
|
|
|
|
ln -s $INSTALL_PATH/openssl-3.2.1/bin/openssl /usr/bin/openssl
|
2024-03-22 14:58:37 +08:00
|
|
|
|
|
|
|
# 设置工作目录
|
|
|
|
WORKDIR $USER_HOME
|
|
|
|
|
|
|
|
# 设置启动用户
|
2024-03-25 14:24:44 +08:00
|
|
|
#USER $GROUP_NAME:$USER_NAME
|
|
|
|
USER root:root
|
2024-03-22 14:58:37 +08:00
|
|
|
|
|
|
|
# 设置执行启动脚本
|
|
|
|
CMD ["/bin/bash"]
|