Created
March 4, 2023 08:38
-
-
Save munsiwoo/7f3b10ace33b0e8ab9480fd15eaa6672 to your computer and use it in GitHub Desktop.
Dockerfile sample (php:8.1-apache)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM php:8.1-apache | |
ENV MYSQL_HOST=localhost \ | |
MYSQL_USER=admin \ | |
MYSQL_PASS=password \ | |
MYSQL_DB=dbname | |
ENV APACHE_RUN_USER www-data | |
ENV APACHE_RUN_GROUP www-data | |
ENV APACHE_LOG_DIR /var/log/apache2 | |
ENV APACHE_RUN_DIR /var/www/html | |
RUN sed -i 's/AllowOverride None/AllowOverride All/g' /etc/apache2/apache2.conf | |
RUN a2enmod rewrite | |
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" | |
RUN sed -i 's/;extension=pdo_mysql/extension=pdo_mysql/g' $PHP_INI_DIR/php.ini | |
RUN sed -i 's/;extension=openssl/extension=openssl/g' $PHP_INI_DIR/php.ini | |
RUN sed -i 's/;extension=mbstring/extension=mbstring/g' $PHP_INI_DIR/php.ini | |
RUN sed -i 's/expose_php = On/expose_php = Off/g' $PHP_INI_DIR/php.ini | |
# For debug | |
RUN sed -i 's/display_errors = Off/display_errors = On/g' $PHP_INI_DIR/php.ini | |
# For file upload | |
RUN sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 10M/g' $PHP_INI_DIR/php.ini | |
RUN sed -i 's/post_max_size = 8M/post_max_size = 12M/g' $PHP_INI_DIR/php.ini | |
RUN sed -i 's/max_input_time = 60/max_input_time = 120/g' $PHP_INI_DIR/php.ini | |
RUN apt update && apt install -y libzip-dev openssl libssl-dev libcurl4-openssl-dev vim | |
RUN docker-php-ext-install mysqli pdo pdo_mysql | |
RUN docker-php-ext-install zip | |
RUN docker-php-ext-enable mysqli pdo pdo_mysql | |
COPY ./index.php /var/www/html/index.php | |
ENV TZ=Asia/Seoul | |
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | |
EXPOSE 80 | |
CMD ["/usr/sbin/apache2", "-D", "FOREGROUND"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo 'It does work'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment