diff --git a/Dockerfile b/Dockerfile index 9ee1471..8dbeea7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,23 +1,27 @@ -FROM alpine:3.15.2 as iconv -COPY ./conf/docker/iconv.sh / -RUN sh /iconv.sh +FROM alpine:3.16 AS vlmcsd +ENV VLMCSD_VERSION="svn1113" +RUN apk add build-base +RUN wget https://github.com/Wind4/vlmcsd/archive/refs/tags/${VLMCSD_VERSION}.tar.gz && tar xf ${VLMCSD_VERSION}.tar.gz +WORKDIR ./vlmcsd-${VLMCSD_VERSION}/ +RUN make && mv ./bin/vlmcs ./bin/vlmcsd ./etc/vlmcsd.kmd /tmp/ -FROM alpine:3.15.2 as vlmcsd -COPY ./conf/docker/vlmcsd.sh / -RUN sh /vlmcsd.sh +FROM alpine:3.16 AS iconv +ENV ICONV_VERSION="1.17" +RUN wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-${ICONV_VERSION}.tar.gz && \ + tar xf libiconv-${ICONV_VERSION}.tar.gz +RUN apk add build-base php8-dev +RUN wget http://php.net/distributions/php-$(php -v | grep -E '^PHP' | awk '{print $2}').tar.gz && \ + tar xf php-*.tar.gz && mv ./php-*/ ./php/ +WORKDIR ./libiconv-${ICONV_VERSION}/ +RUN ./configure && make && make install && \ + mkdir -p /iconv/local/lib/ && cp -d /usr/local/lib/libiconv.so* /iconv/local/lib/ +WORKDIR ../php/ext/iconv/ +RUN sed -i '/blahblah/i\return 0;' config.m4 && \ + phpize && ./configure --with-iconv=/usr/local/ && make && \ + mkdir -p /iconv/lib/php8/modules/ && mv ./modules/iconv.so /iconv/lib/php8/modules/ -FROM alpine:3.15.2 -LABEL maintainer="dnomd343" -COPY . /var/www/kms-server -COPY --from=iconv /tmp/iconv/ /usr/local/lib/ -COPY --from=vlmcsd /tmp/vlmcsd/ /usr/bin/ -RUN apk 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 && \ - mkdir -p /run/nginx && touch /run/nginx/nginx.pid && \ - cp /var/www/kms-server/conf/docker/init.sh / && \ - 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 / +FROM alpine:3.16 +RUN apk add --no-cache nginx php8 php8-fpm php8-iconv +COPY --from=iconv /iconv/ /usr/ +COPY --from=vlmcsd /tmp/vlmcs* /usr/bin/ EXPOSE 1688/tcp 1689/tcp -CMD ["sh","init.sh"] diff --git a/conf/docker/iconv.sh b/conf/docker/iconv.sh deleted file mode 100644 index 2234982..0000000 --- a/conf/docker/iconv.sh +++ /dev/null @@ -1,22 +0,0 @@ -apk add --update wget php7 php7-dev build-base autoconf re2c libtool -mkdir -p /tmp - -wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz -O /tmp/libiconv.tar.gz -tar xf /tmp/libiconv.tar.gz -C /tmp -cd /tmp/libiconv-1.16/ || exit -sed -i 's/_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");/#if HAVE_RAW_DECL_GETS\n_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");\n#endif/g' srclib/stdio.in.h -./configure --prefix=/usr/local -make && make install - -php_version=$(php -r "phpinfo();" | grep "PHP Version" | head -1) -php_version=${php_version#*=> } -wget http://php.net/distributions/php-"$php_version".tar.gz -O /tmp/php.tar.gz -tar xf /tmp/php.tar.gz -C /tmp -cd /tmp/php-"$php_version"/ext/iconv || exit -phpize -./configure --with-iconv=/usr/local -make && make install - -mkdir /tmp/iconv -cp /usr/local/lib/libiconv.so /tmp/iconv -cp /usr/lib/php7/modules/iconv.so /tmp/iconv diff --git a/conf/docker/vlmcsd.sh b/conf/docker/vlmcsd.sh deleted file mode 100644 index 1289d1e..0000000 --- a/conf/docker/vlmcsd.sh +++ /dev/null @@ -1,8 +0,0 @@ -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 || exit && make -mkdir /tmp/vlmcsd -cp /tmp/vlmcsd-build/bin/vlmcs /tmp/vlmcsd/ -cp /tmp/vlmcsd-build/bin/vlmcsd /tmp/vlmcsd/ -cp /tmp/vlmcsd-build/etc/vlmcsd.kmd /tmp/vlmcsd/ -rm -rf /tmp/vlmcsd-build