Browse Source

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

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

9
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"]
EXPOSE 1688/tcp 1689/tcp
CMD ["sh","init.sh"]

62
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
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

Loading…
Cancel
Save