accounts/Dockerfile

127 lines
4.7 KiB
Docker
Raw Normal View History

Upgrade project to PHP 8.3, add PHPStan, upgrade almost every dependency (#36) * start updating to PHP 8.3 * taking off! Co-authored-by: ErickSkrauch <erickskrauch@yandex.ru> Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com> * dropped this Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com> * migrate to symfonymailer Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com> * this is so stupid 😭 Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com> * ah, free, at last. Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com> * oh, Gabriel. Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com> * now dawns thy reckoning. Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com> * and thy gore shall GLISTEN before the temples of man. Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com> * creature of steel. Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com> * my gratitude upon thee for my freedom. Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com> * but the crimes thy kind has committed against humanity Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com> * Upgrade PHP-CS-Fixer and do fix the codebase * First review round (maybe I have broken something) * are NOT forgotten. Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com> * Enable parallel PHP-CS-Fixer runner * PHPStan level 1 * PHPStan level 2 * PHPStan level 3 * PHPStan level 4 * PHPStan level 5 * Levels 6 and 7 takes too much effort. Generate a baseline and fix them eventually * Resolve TODO's related to the php-mock * Drastically reduce baseline size with the Rector * More code modernization with help of the Rector * Update GitLab CI --------- Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com> Co-authored-by: ErickSkrauch <erickskrauch@yandex.ru>
2024-12-02 15:40:55 +05:30
FROM php:8.3.12-fpm-alpine3.20 AS app
# bash needed to support wait-for-it script
2022-12-06 03:14:00 +05:30
RUN apk add --update --no-cache git bash patch openssh dcron \
&& curl -sSLf \
-o /usr/local/bin/install-php-extensions \
https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions \
&& chmod +x /usr/local/bin/install-php-extensions \
Upgrade project to PHP 8.3, add PHPStan, upgrade almost every dependency (#36) * start updating to PHP 8.3 * taking off! Co-authored-by: ErickSkrauch <erickskrauch@yandex.ru> Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com> * dropped this Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com> * migrate to symfonymailer Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com> * this is so stupid 😭 Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com> * ah, free, at last. Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com> * oh, Gabriel. Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com> * now dawns thy reckoning. Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com> * and thy gore shall GLISTEN before the temples of man. Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com> * creature of steel. Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com> * my gratitude upon thee for my freedom. Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com> * but the crimes thy kind has committed against humanity Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com> * Upgrade PHP-CS-Fixer and do fix the codebase * First review round (maybe I have broken something) * are NOT forgotten. Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com> * Enable parallel PHP-CS-Fixer runner * PHPStan level 1 * PHPStan level 2 * PHPStan level 3 * PHPStan level 4 * PHPStan level 5 * Levels 6 and 7 takes too much effort. Generate a baseline and fix them eventually * Resolve TODO's related to the php-mock * Drastically reduce baseline size with the Rector * More code modernization with help of the Rector * Update GitLab CI --------- Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com> Co-authored-by: ErickSkrauch <erickskrauch@yandex.ru>
2024-12-02 15:40:55 +05:30
&& install-php-extensions @composer zip pdo_mysql intl pcntl opcache imagick xdebug \
2021-02-14 23:31:49 +05:30
# Create cron directory
&& mkdir -p /etc/cron.d \
# Install wait-for-it script
&& curl "https://raw.githubusercontent.com/vishnubob/wait-for-it/81b1373f17855/wait-for-it.sh" -o /usr/local/bin/wait-for-it \
2022-12-06 03:14:00 +05:30
&& chmod a+x /usr/local/bin/wait-for-it
2021-02-14 23:31:49 +05:30
# TODO: migrate to the build-pack secrets when they will implement compatibility with the docker-compose
# Feature: https://docs.docker.com/develop/develop-images/build_enhancements/#new-docker-build-secret-information
# Track issues: https://github.com/docker/compose/issues/6358, https://github.com/compose-spec/compose-spec/issues/81
COPY ./composer.* /var/www/html/
ARG build_env=prod
ENV YII_ENV=$build_env
RUN if [ "$build_env" = "prod" ] ; then \
composer install --no-interaction --no-suggest --no-dev --optimize-autoloader; \
else \
composer install --no-interaction --no-suggest; \
fi \
&& composer clear-cache
COPY ./docker/php/*.ini /usr/local/etc/php/conf.d/
COPY ./docker/php/docker-entrypoint.sh /usr/local/bin/
COPY ./docker/cron/* /etc/cron.d/
COPY ./api /var/www/html/api/
COPY ./common /var/www/html/common/
COPY ./console /var/www/html/console/
COPY ./yii /var/www/html/yii
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["php-fpm"]
# ================================================================================
FROM fholzer/nginx-brotli:v1.19.1 AS web
ENV PHP_SERVERS php:9000
# Add headers-more-nginx-module
RUN apk add --update --no-cache --virtual ".nginx-module-build-deps" \
gcc \
make \
libc-dev \
g++ \
openssl-dev \
linux-headers \
pcre-dev \
zlib-dev \
libtool \
automake \
autoconf \
git \
&& cd /opt \
&& git clone --depth 1 -b v0.33 --single-branch https://github.com/openresty/headers-more-nginx-module.git \
&& cd /opt/headers-more-nginx-module \
&& git submodule update --init \
&& cd /opt \
&& wget -O - http://nginx.org/download/nginx-$(nginx -v 2>&1 | sed 's@.*/@@').tar.gz | tar zxfv - \
&& cd /opt/nginx* \
&& ./configure --with-compat --add-dynamic-module=/opt/headers-more-nginx-module \
&& make modules \
&& cp /opt/nginx*/objs/ngx_http_headers_more_filter_module.so /usr/lib/nginx/modules/ \
&& sed -i '1iload_module \/usr\/lib\/nginx\/modules\/ngx_http_headers_more_filter_module.so;' /etc/nginx/nginx.conf \
&& rm -rf /opt/* \
&& apk del ".nginx-module-build-deps" \
# Prepare image for the application
&& rm /etc/nginx/conf.d/default.conf \
&& mkdir -p /data/nginx/cache \
&& mkdir -p /var/www/html
WORKDIR /var/www/html
COPY ./docker/nginx/docker-entrypoint.sh /
COPY ./docker/nginx/generate-upstream.sh /usr/bin/generate-upstream
COPY ./docker/nginx/nginx.conf /etc/nginx/nginx.conf
COPY ./docker/nginx/account.ely.by.conf.template /etc/nginx/conf.d/
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["nginx", "-g", "daemon off;"]
# ================================================================================
2023-11-17 01:13:43 +05:30
FROM bitnami/mariadb:10.6-debian-11 AS db
USER 0
COPY ./docker/mariadb/config.cnf /etc/mysql/conf.d/
RUN set -ex \
&& fetchDeps='ca-certificates wget' \
&& apt-get update \
&& apt-get install -y --no-install-recommends $fetchDeps \
&& rm -rf /var/lib/apt/lists/* \
&& wget -O /mysql-sys.tar.gz 'https://github.com/mysql/mysql-sys/archive/1.5.1.tar.gz' \
&& mkdir /mysql-sys \
&& tar -zxf /mysql-sys.tar.gz -C /mysql-sys \
&& rm /mysql-sys.tar.gz \
&& cd /mysql-sys/*/ \
&& ./generate_sql_file.sh -v 56 -m \
# Fix mysql-sys for MariaDB according to the https://www.fromdual.com/mysql-sys-schema-in-mariadb-10-2 notes
# and https://mariadb.com/kb/en/library/system-variable-differences-between-mariadb-100-and-mysql-56/ reference
&& sed -i -e "s/@@global.server_uuid/@@global.server_id/g" gen/*.sql \
&& sed -i -e "s/@@master_info_repository/NULL/g" gen/*.sql \
&& sed -i -e "s/@@relay_log_info_repository/NULL/g" gen/*.sql \
# Wrap each command, that contains more than one ; terminator into DELIMITER
# and replace the last one to avoid mysql errors
&& sed -i -E 's/^(.+;.+);$/DELIMITER $$\n\n\1$$\n\nDELIMITER ;/g' gen/*.sql \
&& mv gen/*.sql /docker-entrypoint-initdb.d/ \
&& cd / \
&& rm -rf /mysql-sys \
&& apt-get purge -y --auto-remove $fetchDeps
USER 1001
2023-11-17 01:13:43 +05:30
ENTRYPOINT ["/opt/bitnami/scripts/mariadb/entrypoint.sh"]
CMD ["/opt/bitnami/scripts/mariadb/run.sh"]