Browse Source

build: refactor the docker image

master
Dnomd343 2 years ago
parent
commit
6938d6b9a0
  1. 53
      Dockerfile

53
Dockerfile

@ -1,18 +1,37 @@
FROM alpine as asset ARG ALPINE="alpine:3.15"
COPY ./ /
RUN sh /asset.sh
FROM alpine FROM ${ALPINE} as composer
COPY --from=asset /tmp/alltube/ /var/www/alltube/ # TODO: remove php-json after php8 (>=alpine:3.16)
RUN apk --update add --no-cache nginx ffmpeg python3 php php-fpm php-dom php-xml php-zip php-gmp php-json php-phar php-intl php-openssl php-mbstring php-gettext php-xmlwriter php-tokenizer php-simplexml && \ RUN apk add php php-phar php-iconv php-openssl php-json
rm -rf /var/www/localhost && rm -rf /etc/nginx/http.d && \ RUN wget https://install.phpcomposer.com/installer
mv -f /var/www/alltube/nginx.conf /etc/nginx/ && \ RUN php installer
ln -s /usr/bin/python3 /usr/bin/python && \
mv /var/www/alltube/init.sh / && \ FROM ${ALPINE} as build
php /var/www/alltube/composer-setup.php && rm -f /var/www/alltube/composer-setup.php && \ ENV ALLTUBE="3.1.1"
mv ./composer.phar /usr/bin/composer && \ RUN apk add php php-phar php-mbstring php-openssl
chmod 777 /var/www/alltube/templates_c && \ # TODO: remove php-json after php8 (>=alpine:3.16)
cd /var/www/alltube && composer install && \ RUN apk add php-dom php-gmp php-xml php-intl php-json php-gettext php-simplexml php-tokenizer php-xmlwriter
cd ./config && mv config.example.yml config.yml RUN wget https://github.com/Rudloff/alltube/releases/download/${ALLTUBE}/alltube-${ALLTUBE}.zip && \
EXPOSE 80 unzip alltube-${ALLTUBE}.zip
CMD ["sh","init.sh"] COPY --from=composer /composer.phar /usr/bin/composer
WORKDIR ./alltube/
RUN composer install --prefer-dist --no-progress --no-dev --optimize-autoloader
RUN chmod 777 ./templates_c/
WORKDIR ./config/
RUN mv ./config.example.yml ./config.yml
FROM ${ALPINE}
# TODO: remove php-json after php8 (>=alpine:3.16)
# TODO: /usr/bin/python already exist after alpine:3.17
RUN apk add --no-cache nginx python3 php-fpm php-mbstring \
php-dom php-gmp php-xml php-intl php-json php-gettext php-simplexml php-tokenizer php-xmlwriter
COPY --from=build /alltube/ /var/www/alltube/
#RUN apk add php-zip
#RUN
# mv -f /var/www/alltube/nginx.conf /etc/nginx/ && \
# mv /var/www/alltube/init.sh / && \
#EXPOSE 80
#CMD ["sh","init.sh"]

Loading…
Cancel
Save