我想根据 这些说明为 podman (almalinux:8) 容器内的 rhel8 构建 haproxy。
从这样构建的镜像运行容器
FROM almalinux:8
COPY make_ha_proxy.sh /usr/local/bin
ENTRYPOINT ["make_ha_proxy.sh"]
构建 hopraxy 时会崩溃。
当我这样做时
podman run -tdi --rm --name test -v ./return:/tmp/binary_return almalinux:8
podman cp make_ha_proxy.sh test:/usr/local/bin
podman exec -it test2 bash /usr/local/bin/make_ha_proxy.sh
相反,我可以随后从
./return
目录收集我的二进制文件,因此我的脚本总体上似乎可以工作。
#!/usr/bin/bash
HAPROXY_MINOR='2.8.2'
HAPROXY_MAJOR='2.8'
LUA_VERSION='5.4.6'
RETURN_DIR='/tmp/binary_return/'
# installing dependencies
dnf update -y
dnf install -y gcc openssl-devel readline-devel systemd-devel make pcre-devel file
# get and build lua
mkdir -p /opt/lua && cd /opt/lua || exit
curl https://www.lua.org/ftp/lua-${LUA_VERSION}.tar.gz > lua-${LUA_VERSION}.tar.gz
tar xvf lua-${LUA_VERSION}.tar.gz && cd lua-${LUA_VERSION} || exit
make INSTALL_TOP=/opt/lua-${LUA_VERSION} linux install
lua_rc=$?
if [ ${lua_rc} != 0 ] ; then
echo "building lua failed !" ; exit 1
fi
# get and build ha_proxy
mkdir -p /opt/haproxy && cd /opt/haproxy || exit
curl http://www.haproxy.org/download/${HAPROXY_MAJOR}/src/haproxy-${HAPROXY_MINOR}.tar.gz > haproxy-${HAPROXY_MINOR}.tar.gz
curl http://www.haproxy.org/download/${HAPROXY_MAJOR}/src/haproxy-${HAPROXY_MINOR}.tar.gz.sha256 > haproxy-${HAPROXY_MINOR}.tar.gz.sha256
cd /opt/haproxy && tar xvf haproxy-${HAPROXY_MINOR}.tar.gz
cd /opt/haproxy/haproxy-${HAPROXY_MINOR} || exit
make USE_NS=1 \
USE_TFO=1 \
USE_OPENSSL=1 \
USE_ZLIB=1 \
USE_LUA=1 \
USE_PCRE=1 \
USE_SYSTEMD=1 \
USE_LIBCRYPT=1 \
USE_THREAD=1 \
TARGET=linux-glibc \
LUA_INC=/opt/lua-${LUA_VERSION}/include \
LUA_LIB=/opt/lua-${LUA_VERSION}/lib
make PREFIX=/opt/haproxy-${HAPROXY_MINOR} install
# move the build binary to the return directory
if [ ! -d ${RETURN_DIR} ] ; then
mkdir -p -- "${RETURN_DIR}"
fi
# copying the created binary to the return directory
if [ $(file -b --mime-type /opt/haproxy/haproxy-${HAPROXY_MINOR}/haproxy | sed 's|/.*||') == application ] ; then
cp /opt/haproxy/haproxy-${HAPROXY_MINOR}/haproxy "${RETURN_DIR}"/
else
exit 1
fi
exit 0
任何提示,我的问题可能是什么?
似乎我的 Dockerfile 中的
ENTRYPOINT
需要整个路径,而不仅仅是脚本的名称
FROM almalinux:8
COPY make_ha_proxy.sh /usr/local/bin
ENTRYPOINT ["/usr/local/bin/make_ha_proxy.sh"]