Merge pull request #1869 from shaarli/docker-alpine-php8

update docker images to use PHP 8
This commit is contained in:
nodiscc 2022-09-24 15:58:23 +00:00 committed by GitHub
commit dc589b7490
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 60 additions and 57 deletions

View file

@ -1,2 +1,2 @@
#!/bin/execlineb -P #!/bin/execlineb -P
php-fpm7 -F php-fpm8 -F

View file

@ -32,29 +32,30 @@ LABEL maintainer="Shaarli Community"
RUN apk --update --no-cache add \ RUN apk --update --no-cache add \
ca-certificates \ ca-certificates \
nginx \ nginx \
php7 \ php8 \
php7-ctype \ php8-ctype \
php7-curl \ php8-curl \
php7-fpm \ php8-fpm \
php7-gd \ php8-gd \
php7-iconv \ php8-gettext \
php7-intl \ php8-iconv \
php7-json \ php8-intl \
php7-mbstring \ php8-json \
php7-openssl \ php8-mbstring \
php7-session \ php8-openssl \
php7-xml \ php8-session \
php7-simplexml \ php8-xml \
php7-zlib \ php8-simplexml \
php8-zlib \
s6 s6
COPY .docker/nginx.conf /etc/nginx/nginx.conf COPY .docker/nginx.conf /etc/nginx/nginx.conf
COPY .docker/php-fpm.conf /etc/php7/php-fpm.conf COPY .docker/php-fpm.conf /etc/php8/php-fpm.conf
COPY .docker/services.d /etc/services.d COPY .docker/services.d /etc/services.d
RUN rm -rf /etc/php7/php-fpm.d/www.conf \ RUN rm -rf /etc/php8/php-fpm.d/www.conf \
&& sed -i 's/post_max_size.*/post_max_size = 10M/' /etc/php7/php.ini \ && sed -i 's/post_max_size.*/post_max_size = 10M/' /etc/php8/php.ini \
&& sed -i 's/upload_max_filesize.*/upload_max_filesize = 10M/' /etc/php7/php.ini && sed -i 's/upload_max_filesize.*/upload_max_filesize = 10M/' /etc/php8/php.ini
WORKDIR /var/www WORKDIR /var/www

View file

@ -3,7 +3,7 @@
# - Build documentation # - Build documentation
FROM arm32v6/alpine:3.16 as docs FROM arm32v6/alpine:3.16 as docs
ADD . /usr/src/app/shaarli ADD . /usr/src/app/shaarli
RUN apk --update --no-cache add py2-pip \ RUN apk --update --no-cache add py3-pip \
&& cd /usr/src/app/shaarli \ && cd /usr/src/app/shaarli \
&& pip install --no-cache-dir mkdocs \ && pip install --no-cache-dir mkdocs \
&& mkdocs build --clean && mkdocs build --clean
@ -12,7 +12,7 @@ RUN apk --update --no-cache add py2-pip \
# - Resolve PHP dependencies with Composer # - Resolve PHP dependencies with Composer
FROM arm32v6/alpine:3.16 as composer FROM arm32v6/alpine:3.16 as composer
COPY --from=docs /usr/src/app/shaarli /app/shaarli COPY --from=docs /usr/src/app/shaarli /app/shaarli
RUN apk --update --no-cache add php7-curl php7-mbstring php7-simplexml composer \ RUN apk --update --no-cache add php8-curl php8-mbstring php8-simplexml composer \
&& cd /app/shaarli \ && cd /app/shaarli \
&& composer --prefer-dist --no-dev install && composer --prefer-dist --no-dev install
@ -20,7 +20,7 @@ RUN apk --update --no-cache add php7-curl php7-mbstring php7-simplexml composer
# - Frontend dependencies # - Frontend dependencies
FROM arm32v6/alpine:3.16 as node FROM arm32v6/alpine:3.16 as node
COPY --from=composer /app/shaarli /shaarli COPY --from=composer /app/shaarli /shaarli
RUN apk --update --no-cache add yarn nodejs-current python2 build-base \ RUN apk --update --no-cache add yarn nodejs-current python3 build-base \
&& cd /shaarli \ && cd /shaarli \
&& yarnpkg install \ && yarnpkg install \
&& yarnpkg run build \ && yarnpkg run build \
@ -34,28 +34,28 @@ LABEL maintainer="Shaarli Community"
RUN apk --update --no-cache add \ RUN apk --update --no-cache add \
ca-certificates \ ca-certificates \
nginx \ nginx \
php7 \ php8 \
php7-ctype \ php8-ctype \
php7-curl \ php8-curl \
php7-fpm \ php8-fpm \
php7-gd \ php8-gd \
php7-iconv \ php8-iconv \
php7-intl \ php8-intl \
php7-json \ php8-json \
php7-mbstring \ php8-mbstring \
php7-openssl \ php8-openssl \
php7-session \ php8-session \
php7-xml \ php8-xml \
php7-zlib \ php8-zlib \
s6 s6
COPY .docker/nginx.conf /etc/nginx/nginx.conf COPY .docker/nginx.conf /etc/nginx/nginx.conf
COPY .docker/php-fpm.conf /etc/php7/php-fpm.conf COPY .docker/php-fpm.conf /etc/php8/php-fpm.conf
COPY .docker/services.d /etc/services.d COPY .docker/services.d /etc/services.d
RUN rm -rf /etc/php7/php-fpm.d/www.conf \ RUN rm -rf /etc/php8/php-fpm.d/www.conf \
&& sed -i 's/post_max_size.*/post_max_size = 10M/' /etc/php7/php.ini \ && sed -i 's/post_max_size.*/post_max_size = 10M/' /etc/php8/php.ini \
&& sed -i 's/upload_max_filesize.*/upload_max_filesize = 10M/' /etc/php7/php.ini && sed -i 's/upload_max_filesize.*/upload_max_filesize = 10M/' /etc/php8/php.ini
WORKDIR /var/www WORKDIR /var/www

View file

@ -165,7 +165,7 @@ htmldoc:
### Generate Shaarli's translation compiled file (.mo) ### Generate Shaarli's translation compiled file (.mo)
translate: translate:
@find inc/languages/ -name shaarli.po -execdir msgfmt shaarli.po -o shaarli.mo \; @for pofile in $(find inc/languages/ -name shaarli.po); do msgfmt "$pofile" -o "$(dirname "$pofile")/$(basename "$pofile" .po).mo"; done
### Run ESLint check against Shaarli's JS files ### Run ESLint check against Shaarli's JS files
eslint: eslint:

View file

@ -5,23 +5,25 @@ RUN apk --update --no-cache add \
ca-certificates \ ca-certificates \
curl \ curl \
make \ make \
php7 \ php8 \
php7-ctype \ php8-ctype \
php7-curl \ php8-curl \
php7-dom \ php8-dom \
php7-gd \ php8-gd \
php7-iconv \ php8-gettext \
php7-intl \ php8-iconv \
php7-json \ php8-intl \
php7-mbstring \ php8-json \
php7-openssl \ php8-mbstring \
php7-phar \ php8-openssl \
php7-session \ php8-phar \
php7-simplexml \ php8-session \
php7-tokenizer \ php8-simplexml \
php7-xdebug \ php8-tokenizer \
php7-xml \ php8-xdebug \
php7-zlib \ php8-xmlwriter \
php8-xml \
php8-zlib \
rsync rsync
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer