Browse Source

feat: build vlmcsd locally, add vlmcsd.kmd for more info #1

master
Dnomd343 3 years ago
parent
commit
544561c3da
  1. 7
      Dockerfile
  2. 62
      conf/docker/vlmcsd.sh

7
Dockerfile

@ -4,14 +4,13 @@ RUN sh /iconv.sh
FROM alpine as vlmcsd FROM alpine as vlmcsd
COPY ./conf/docker/vlmcsd.sh / COPY ./conf/docker/vlmcsd.sh /
RUN apk --update add --no-cache curl wget && \ RUN sh /vlmcsd.sh
sh /vlmcsd.sh
FROM alpine FROM alpine
LABEL maintainer="dnomd343" LABEL maintainer="dnomd343"
COPY . /var/www/kms-server COPY . /var/www/kms-server
COPY --from=iconv /tmp/iconv/ /usr/local/lib/ 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 && \ 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/ && \ 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 && \ 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 /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 -f /var/www/kms-server/conf/docker/nginx.conf /etc/nginx/nginx.conf && \
cp /var/www/kms-server/conf/docker/init.sh / cp /var/www/kms-server/conf/docker/init.sh /
EXPOSE 1688 1689 EXPOSE 1688/tcp 1689/tcp
CMD ["sh","init.sh"] CMD ["sh","init.sh"]

62
conf/docker/vlmcsd.sh

@ -1,54 +1,8 @@
get_github_latest_version() { apk add --no-cache git make build-base
VERSION=$(curl --silent "https://api.github.com/repos/$1/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'); git clone --branch master --single-branch https://github.com/Wind4/vlmcsd.git /tmp/vlmcsd-build
} cd /tmp/vlmcsd-build
make
get_architecture() { mkdir /tmp/vlmcsd
case "$(uname -m)" in cp /tmp/vlmcsd-build/bin/vlmcsd /tmp/vlmcsd/
'i386' | 'i686') cp /tmp/vlmcsd-build/etc/vlmcsd.kmd /tmp/vlmcsd/
MACHINE='i386' rm -rf /tmp/vlmcsd-build
;;
'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

Loading…
Cancel
Save