From 2ae9403f5347610d4b0bb40424fb7d24df2ec980 Mon Sep 17 00:00:00 2001 From: Endial Fang Date: Fri, 11 Sep 2020 09:51:39 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=E6=9B=B4=E6=96=B0=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E8=BE=93=E5=87=BA=E6=A0=BC=E5=BC=8F=EF=BC=9B=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?download=5Fpkg=E4=B8=8B=E8=BD=BD=E7=AD=BE=E5=90=8D=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 30 ++++++++++++++++++-- alpine/Dockerfile | 7 +++-- alpine/prebuilds/usr/local/scripts/liblog.sh | 2 +- alpine/prebuilds/usr/sbin/download_pkg | 9 +++--- prebuilds/usr/local/scripts/liblog.sh | 2 +- prebuilds/usr/sbin/download_pkg | 9 +++--- 6 files changed, 45 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8f0fa22..a43c096 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,8 @@ FROM debian:buster-slim # APT源配置:default / tencent / ustc / aliyun / huawei ARG apt_source=tencent -ENV APP_USER=builder +ENV APP_NAME=dbuilder \ + APP_USER=builder LABEL \ "Version"="v10" \ @@ -16,7 +17,32 @@ LABEL \ COPY prebuilds / COPY customer / RUN select_source ${apt_source} -RUN install_pkg sudo wget curl git ca-certificates iproute2 net-tools nano dpkg gnupg dirmngr apt-utils apt-transport-https lsb-release iputils-ping build-essential cmake libcmocka-dev + +# 以下命令安装的软件包 +# apt-transport-https apt-utils binutils binutils-common +# binutils-x86-64-linux-gnu build-essential bzip2 ca-certificates cmake +# cmake-data cpp cpp-8 curl dirmngr distro-info-data dpkg-dev g++ g++-8 gcc +# gcc-8 git git-man gnupg gnupg-l10n gnupg-utils gpg gpg-agent gpg-wks-client +# gpg-wks-server gpgconf gpgsm iproute2 iputils-ping libapt-inst2.0 +# libarchive13 libasan5 libassuan0 libatomic1 libbinutils libc-dev-bin +# libc6-dev libcap2 libcap2-bin libcc1-0 libcmocka-dev libcmocka0 +# libcurl3-gnutls libcurl4 libdpkg-perl libelf1 liberror-perl libexpat1 +# libgcc-8-dev libgdbm-compat4 libgdbm6 libglib2.0-0 libgomp1 libgssapi-krb5-2 +# libicu63 libisl19 libitm1 libjsoncpp1 libk5crypto3 libkeyutils1 libkrb5-3 +# libkrb5support0 libksba8 libldap-2.4-2 libldap-common liblsan0 libmnl0 +# libmpc3 libmpdec2 libmpfr6 libmpx2 libncurses6 libnghttp2-14 libnpth0 +# libpcre2-8-0 libperl5.28 libprocps7 libpsl5 libpython3-stdlib +# libpython3.7-minimal libpython3.7-stdlib libquadmath0 libreadline7 librhash0 +# librtmp1 libsasl2-2 libsasl2-modules-db libsqlite3-0 libssh2-1 libssl-dev +# libssl1.1 libstdc++-8-dev libtsan0 libubsan1 libuv1 libxml2 libxtables12 +# linux-libc-dev lsb-base lsb-release make mime-support nano net-tools openssl +# patch perl perl-modules-5.28 pinentry-curses pkg-config procps python3 +# python3-minimal python3.7 python3.7-minimal readline-common sudo wget +# xz-utils +RUN install_pkg sudo wget curl git ca-certificates iproute2 net-tools nano \ + dpkg gnupg dirmngr apt-utils apt-transport-https lsb-release iputils-ping \ + build-essential cmake libcmocka-dev pkg-config libssl-dev + RUN prepare_env && create_user CMD [] \ No newline at end of file diff --git a/alpine/Dockerfile b/alpine/Dockerfile index e9afb2c..6d81cb7 100644 --- a/alpine/Dockerfile +++ b/alpine/Dockerfile @@ -8,7 +8,8 @@ FROM alpine:3.12 # APK源配置:default / tencent / ustc / aliyun / huawei ARG apt_source=tencent -ENV APP_USER=builder +ENV APP_NAME=abuilder \ + APP_USER=builder LABEL \ "Version"="v3.12" \ @@ -19,7 +20,9 @@ LABEL \ COPY prebuilds / COPY customer / RUN select_source ${apt_source} -RUN install_pkg sudo wget git curl ca-certificates iproute2 net-tools nano dpkg gnupg bash build-base cmake cmocka-dev +RUN install_pkg sudo wget git curl ca-certificates iproute2 net-tools nano \ + dpkg gnupg bash build-base cmake pkgconf \ + linux-headers cmocka-dev openssl-dev RUN prepare_env && create_user CMD [] \ No newline at end of file diff --git a/alpine/prebuilds/usr/local/scripts/liblog.sh b/alpine/prebuilds/usr/local/scripts/liblog.sh index 36bae05..5ab71aa 100644 --- a/alpine/prebuilds/usr/local/scripts/liblog.sh +++ b/alpine/prebuilds/usr/local/scripts/liblog.sh @@ -41,7 +41,7 @@ stderr_print() { # $1 - 日志类型 # $2 - 日志信息 LOG() { - stderr_print "${ENV_DEBUG:+${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N")}${RESET} ${*}" + stderr_print "${CYAN}${APP_NAME:-}${ENV_DEBUG:+\:${MODULE:-} ${MAGENTA}$(date "+%T")}${RESET} ${*}" } # 输出调试类日志信息,尽量少使用 diff --git a/alpine/prebuilds/usr/sbin/download_pkg b/alpine/prebuilds/usr/sbin/download_pkg index 7d1cba4..ca216c4 100755 --- a/alpine/prebuilds/usr/sbin/download_pkg +++ b/alpine/prebuilds/usr/sbin/download_pkg @@ -110,14 +110,15 @@ cd $INSTALL_ROOT LOG_I "Downloading $PACKAGE package" for url in $PACKAGE_URLS; do - LOG_D "Try $url/$PACKAGE" + LOG_D "Try $url/$PACKAGE" if wget -O "$CACHE_ROOT/$PACKAGE" "$url/$PACKAGE" && [ -s "$CACHE_ROOT/$PACKAGE" ]; then if [ -n "${PACKAGE_KEYS:-}" ]; then - wget -O "$CACHE_ROOT/$PACKAGE.asc" "$url/$PACKAGE.asc" || wget -O "$CACHE_ROOT/$PACKAGE.asc" "$url/$PACKAGE.sign" - if [ -e "$CACHE_ROOT/$PACKAGE.asc" ]; then - break + wget -O "$CACHE_ROOT/$PACKAGE.asc" "$url/$PACKAGE.asc" || wget -O "$CACHE_ROOT/$PACKAGE.asc" "$url/$PACKAGE.sign" || : + if [ ! -e "$CACHE_ROOT/$PACKAGE.asc" ]; then + exit 1 fi fi + break fi done diff --git a/prebuilds/usr/local/scripts/liblog.sh b/prebuilds/usr/local/scripts/liblog.sh index 36bae05..1dfae49 100644 --- a/prebuilds/usr/local/scripts/liblog.sh +++ b/prebuilds/usr/local/scripts/liblog.sh @@ -41,7 +41,7 @@ stderr_print() { # $1 - 日志类型 # $2 - 日志信息 LOG() { - stderr_print "${ENV_DEBUG:+${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N")}${RESET} ${*}" + stderr_print "${CYAN}${APP_NAME:-}${ENV_DEBUG:+\:${MODULE:-} ${MAGENTA}$(date "+%T.%2N")}${RESET} ${*}" } # 输出调试类日志信息,尽量少使用 diff --git a/prebuilds/usr/sbin/download_pkg b/prebuilds/usr/sbin/download_pkg index d7a6f7b..174ab93 100755 --- a/prebuilds/usr/sbin/download_pkg +++ b/prebuilds/usr/sbin/download_pkg @@ -110,14 +110,15 @@ cd $INSTALL_ROOT LOG_I "Downloading $PACKAGE package" for url in $PACKAGE_URLS; do - LOG_D "Try $url/$PACKAGE" + LOG_D "Try $url/$PACKAGE" if wget -O "$CACHE_ROOT/$PACKAGE" "$url/$PACKAGE" && [ -s "$CACHE_ROOT/$PACKAGE" ]; then if [ -n "${PACKAGE_KEYS:-}" ]; then - wget -O "$CACHE_ROOT/$PACKAGE.asc" "$url/$PACKAGE.asc" || wget -O "$CACHE_ROOT/$PACKAGE.asc" "$url/$PACKAGE.sign" - if [ -e "$CACHE_ROOT/$PACKAGE.asc" ]; then - break + wget -O "$CACHE_ROOT/$PACKAGE.asc" "$url/$PACKAGE.asc" || wget -O "$CACHE_ROOT/$PACKAGE.asc" "$url/$PACKAGE.sign" || : + if [ ! -e "$CACHE_ROOT/$PACKAGE.asc" ]; then + exit 1 fi fi + break fi done