Browse Source

update: docker build process, upgrade to `php8` and `iconv-1.17`

master
dnomd343 2 years ago
parent
commit
a9c63c6753
  1. 44
      Dockerfile
  2. 22
      conf/docker/iconv.sh
  3. 8
      conf/docker/vlmcsd.sh

44
Dockerfile

@ -1,23 +1,27 @@
FROM alpine:3.15.2 as iconv FROM alpine:3.16 AS vlmcsd
COPY ./conf/docker/iconv.sh / ENV VLMCSD_VERSION="svn1113"
RUN sh /iconv.sh 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 FROM alpine:3.16 AS iconv
COPY ./conf/docker/vlmcsd.sh / ENV ICONV_VERSION="1.17"
RUN sh /vlmcsd.sh 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 FROM alpine:3.16
LABEL maintainer="dnomd343" RUN apk add --no-cache nginx php8 php8-fpm php8-iconv
COPY . /var/www/kms-server COPY --from=iconv /iconv/ /usr/
COPY --from=iconv /tmp/iconv/ /usr/local/lib/ COPY --from=vlmcsd /tmp/vlmcs* /usr/bin/
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 /
EXPOSE 1688/tcp 1689/tcp EXPOSE 1688/tcp 1689/tcp
CMD ["sh","init.sh"]

22
conf/docker/iconv.sh

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

8
conf/docker/vlmcsd.sh

@ -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
Loading…
Cancel
Save