From 544561c3da7c10fcbc68741b2260e5477d17b3e9 Mon Sep 17 00:00:00 2001 From: Dnomd343 Date: Thu, 5 Aug 2021 14:31:29 +0800 Subject: [PATCH] feat: build vlmcsd locally, add vlmcsd.kmd for more info #1 --- Dockerfile | 9 +++---- conf/docker/vlmcsd.sh | 62 ++++++------------------------------------- 2 files changed, 12 insertions(+), 59 deletions(-) diff --git a/Dockerfile b/Dockerfile index 051c597..4cd35b2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,14 +4,13 @@ RUN sh /iconv.sh FROM alpine as vlmcsd COPY ./conf/docker/vlmcsd.sh / -RUN apk --update add --no-cache curl wget && \ - sh /vlmcsd.sh +RUN sh /vlmcsd.sh FROM alpine LABEL maintainer="dnomd343" COPY . /var/www/kms-server COPY --from=iconv /tmp/iconv/ /usr/local/lib/ -COPY --from=vlmcsd /tmp/vlmcsd/vlmcsd /usr/bin/vlmcsd +COPY --from=vlmcsd /tmp/vlmcsd/ /usr/bin/ RUN apk --update add --no-cache nginx curl php7 php7-fpm php7-json php7-iconv php7-sqlite3 && \ rm /usr/lib/php7/modules/iconv.so && ln -s /usr/local/lib/iconv.so /usr/lib/php7/modules/ && \ mv /usr/local/lib/libiconv.so /usr/local/lib/libiconv.so.2 && \ @@ -20,5 +19,5 @@ RUN apk --update add --no-cache nginx curl php7 php7-fpm php7-json php7-iconv ph cp /var/www/kms-server/conf/docker/kms.conf /etc/nginx/kms.conf && \ cp -f /var/www/kms-server/conf/docker/nginx.conf /etc/nginx/nginx.conf && \ cp /var/www/kms-server/conf/docker/init.sh / -EXPOSE 1688 1689 -CMD ["sh","init.sh"] \ No newline at end of file +EXPOSE 1688/tcp 1689/tcp +CMD ["sh","init.sh"] diff --git a/conf/docker/vlmcsd.sh b/conf/docker/vlmcsd.sh index e010545..665ba68 100644 --- a/conf/docker/vlmcsd.sh +++ b/conf/docker/vlmcsd.sh @@ -1,54 +1,8 @@ -get_github_latest_version() { - VERSION=$(curl --silent "https://api.github.com/repos/$1/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'); -} - -get_architecture() { - case "$(uname -m)" in - 'i386' | 'i686') - MACHINE='i386' - ;; - 'amd64' | 'x86_64') - MACHINE='amd64' - ;; - 'armv7' | 'armv7l') - MACHINE='arm' - ;; - 'armv8' | 'aarch64') - MACHINE='arm64' - ;; - *) - echo "The architecture is not supported." - exit 1 - ;; - esac -} - -VLMCSD_DIR="/tmp/vlmcsd" -PKG_DIR="$VLMCSD_DIR/pkg" -mkdir -p $PKG_DIR - -get_architecture -case "$MACHINE" in - 'i386') - VLMCSD_PATH="binaries/Linux/intel/static/vlmcsd-x86-musl-static" - ;; - 'amd64') - VLMCSD_PATH="binaries/Linux/intel/static/vlmcsd-x64-musl-static" - ;; - 'arm') - VLMCSD_PATH="binaries/Linux/arm/little-endian/static/vlmcsd-armv7el-uclibc-static" - ;; - 'arm64') - VLMCSD_PATH="binaries/Linux/arm/little-endian/static/vlmcsd-armv7el-uclibc-static" - ;; - *) - exit 1 - ;; -esac - -get_github_latest_version "Wind4/vlmcsd" -wget -P $PKG_DIR "https://github.com/Wind4/vlmcsd/releases/download/$VERSION/binaries.tar.gz" -tar xf $PKG_DIR/binaries.tar.gz -C $PKG_DIR -mv $PKG_DIR/$VLMCSD_PATH $VLMCSD_DIR/vlmcsd - -rm -rf $PKG_DIR \ No newline at end of file +apk add --no-cache git make build-base +git clone --branch master --single-branch https://github.com/Wind4/vlmcsd.git /tmp/vlmcsd-build +cd /tmp/vlmcsd-build +make +mkdir /tmp/vlmcsd +cp /tmp/vlmcsd-build/bin/vlmcsd /tmp/vlmcsd/ +cp /tmp/vlmcsd-build/etc/vlmcsd.kmd /tmp/vlmcsd/ +rm -rf /tmp/vlmcsd-build