Created
February 14, 2024 19:05
-
-
Save huksley/05903dc8d4e545c9e41bafc4f960ec98 to your computer and use it in GitHub Desktop.
Simple PHP dokku application with a custom Docker container
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
ExtendedStatus On | |
<IfModule mpm_prefork_module> | |
StartServers 2 | |
MinSpareServers 2 | |
MaxSpareServers 4 | |
MaxRequestWorkers 20 | |
MaxConnectionsPerChild 100 | |
</IfModule> | |
<VirtualHost *:80> | |
ServerName example.com | |
ServerAlias www.example.com | |
DocumentRoot /var/www/html | |
<Directory /var/www/html> | |
Options FollowSymLinks MultiViews | |
AllowOverride All | |
Order allow,deny | |
Allow from all | |
</Directory> | |
ErrorLog /var/log/apache2/error.log | |
LogLevel warn | |
LogFormat "%{X-Real-IP}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\" %D" combined2 | |
CustomLog /var/log/apache2/access.log combined2 | |
AddDefaultCharset UTF-8 | |
RedirectMatch 404 /\\.git(/.*|$) | |
</VirtualHost> |
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.2-apache | |
RUN apt-get update && apt-get install -y \ | |
libfreetype-dev \ | |
libjpeg62-turbo-dev \ | |
libpng-dev \ | |
&& docker-php-ext-configure gd --with-freetype --with-jpeg \ | |
&& docker-php-ext-install -j$(nproc) gd | |
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" | |
COPY ./apache.conf /etc/apache2/sites-enabled/000-default.conf | |
COPY ./index.html /var/www/html |
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
NAME=example.com | |
DBNAME=example-com | |
[email protected] | |
WEBDIR=/home/ubuntu/example.com/www | |
dokku apps:create $NAME | |
dokku domains:add $NAME $NAME www.$NAME | |
dokku mariadb:create $DBNAME | |
cat dump.sql | dokku mariadb:import $DBNAME | |
dokku mariadb:link $DBNAME $NAME | |
dokku letsencrypt:set $NAME email $EMAIL | |
dokku letsencrypt:enable $NAME | |
dokku nginx:stop | |
dokku nginx:start | |
dokku letsencrypt:active $NAME | |
dokku letsencrypt:cron-job --add | |
dokku storage:mount $NAME $WEBDIR:/var/www/html | |
dokku ps:restart $NAME |
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
Empty, wait for content to be mounted |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment