Browse Source

build: update docker image

master
Dnomd343 2 years ago
parent
commit
f0f13bef5b
  1. 43
      Dockerfile

43
Dockerfile

@ -1,37 +1,36 @@
FROM alpine:3.16 AS vlmcsd FROM alpine:3.16 AS vlmcsd
ENV VLMCSD_VERSION="svn1113" ENV VLMCSD="svn1113"
RUN apk add build-base 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 RUN wget https://github.com/Wind4/vlmcsd/archive/refs/tags/${VLMCSD}.tar.gz && tar xf ${VLMCSD}.tar.gz
WORKDIR ./vlmcsd-${VLMCSD_VERSION}/ WORKDIR ./vlmcsd-${VLMCSD}/
RUN make && mv ./bin/vlmcs ./bin/vlmcsd ./etc/vlmcsd.kmd /tmp/ RUN make && mv ./bin/vlmcs ./bin/vlmcsd ./etc/vlmcsd.kmd /tmp/
FROM alpine:3.16 AS iconv FROM alpine:3.16 AS iconv
ENV ICONV_VERSION="1.17" ENV ICONV="1.17"
RUN wget https://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 apk add build-base php8-dev
RUN wget https://php.net/distributions/php-$(php -v | grep -E '^PHP' | awk '{print $2}').tar.gz && \ RUN wget https://ftp.gnu.org/pub/gnu/libiconv/libiconv-${ICONV}.tar.gz && tar xf libiconv-${ICONV}.tar.gz
tar xf php-*.tar.gz && mv ./php-*/ ./php/ RUN wget https://php.net/distributions/php-$(php -v | awk 'NR==1 {print $2}').tar.gz && \
WORKDIR ./libiconv-${ICONV_VERSION}/ tar xf php-*.tar.gz && mv ./php-*/ ./php8/
RUN ./configure && make && make install && \ WORKDIR /libiconv-${ICONV}/
mkdir -p /iconv/local/lib/ && cp -d /usr/local/lib/libiconv.so* /iconv/local/lib/ RUN ./configure && make && make install && cp ./lib/.libs/libiconv.so.2 /tmp/
WORKDIR ../php/ext/iconv/ WORKDIR /php8/ext/iconv/
RUN sed -i '/blahblah/i\return 0;' config.m4 && \ RUN sed -i '/blahblah/i\return 0;' config.m4 && phpize && \
phpize && ./configure --with-iconv=/usr/local/ && make && \ ./configure --with-iconv=/usr/local && make && mv ./modules/iconv.so /tmp/
mkdir -p /iconv/lib/php8/modules/ && mv ./modules/iconv.so /iconv/lib/php8/modules/ RUN strip /tmp/*.so*
FROM alpine:3.16 AS asset FROM alpine:3.16 AS asset
COPY --from=iconv /iconv/ /asset/usr/
COPY --from=vlmcsd /tmp/vlmcs* /asset/usr/bin/ COPY --from=vlmcsd /tmp/vlmcs* /asset/usr/bin/
RUN apk add php8-fpm && mkdir -p /asset/etc/php8/ && \ COPY --from=iconv /tmp/libiconv.so.2 /asset/usr/local/lib/
sed -i 's/^;\(pid\)/\1/' /etc/php8/php-fpm.conf && \ COPY --from=iconv /tmp/iconv.so /asset/usr/lib/php8/modules/
mv /etc/php8/php-fpm.conf /asset/etc/php8/ RUN apk add php8-fpm
COPY . /asset/kms-server/ WORKDIR /asset/etc/php8/
RUN mkdir -p /asset/etc/ && mv /asset/kms-server/nginx/ /asset/etc/ RUN sed -i 's/^;\(pid\)/\1/' /etc/php8/php-fpm.conf && mv /etc/php8/php-fpm.conf ./
COPY ./nginx/ /asset/etc/nginx/
COPY ./ /asset/kms-server/
FROM alpine:3.16 FROM alpine:3.16
RUN apk add --no-cache nginx php8 php8-fpm php8-iconv php8-pcntl php8-posix RUN apk add --no-cache nginx php8 php8-fpm php8-iconv php8-pcntl php8-posix
COPY --from=asset /asset/ / COPY --from=asset /asset/ /
EXPOSE 1688/tcp 1689/tcp EXPOSE 1688/tcp 1689/tcp
WORKDIR /kms-server/ WORKDIR /kms-server/
ENTRYPOINT ["php", "main.php"] ENTRYPOINT ["kms.php"]

Loading…
Cancel
Save